Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .github/workflows/push_pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:

jobs:
macos:
runs-on: macos-15
runs-on: macos-26
if: ${{ github.repository == 'espressomd/espresso' }}
steps:
- name: Checkout
Expand All @@ -24,19 +24,13 @@ jobs:
- name: Install dependencies
run: |
echo '' > Brewfile
for dep in boost boost-mpi fftw gsl ccache ninja; do echo "brew \"${dep}\"" >> Brewfile; done
for dep in boost boost-mpi libomp fftw gsl ccache ninja; do echo "brew \"${dep}\"" >> Brewfile; done
brew bundle check >/dev/null 2>&1 || brew bundle --verbose --no-upgrade
# set up Xcode compiler
echo "::group::List available Xcode compilers"
ls /Applications | grep Xcode
echo "::endgroup::"
sudo xcode-select -switch /Applications/Xcode_16.4.app
echo "::group::Install OpenMP (https://mac.r-project.org/openmp/)"
curl -s -o ${{ runner.temp }}/openmp.tar.gz https://mac.r-project.org/openmp/openmp-19.1.0-darwin20-Release.tar.gz
sudo tar fvxz ${{ runner.temp }}/openmp.tar.gz -C /
rm ${{ runner.temp }}/openmp.tar.gz
codesign -d -vv /usr/local/lib/libomp.dylib
echo "::endgroup::"
sudo xcode-select -switch /Applications/Xcode_26.2.0.app
# Python dependencies
python -m venv venv
. venv/bin/activate
Expand All @@ -59,7 +53,7 @@ jobs:
debian:
runs-on: ubuntu-latest
container:
image: ghcr.io/espressomd/docker/debian:3388b293a5e8a9b613b1bfa4220e54dfb4bff245-base-layer
image: ghcr.io/espressomd/docker/debian:4d3e236db5ae334ddcc9c3c82aae7637faa5dabc-base-layer
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand Down Expand Up @@ -101,7 +95,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository == 'espressomd/espresso' }}
container:
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:3388b293a5e8a9b613b1bfa4220e54dfb4bff245-base-layer
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:4d3e236db5ae334ddcc9c3c82aae7637faa5dabc-base-layer
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand Down Expand Up @@ -143,7 +137,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.repository == 'espressomd/espresso' }}
container:
image: ghcr.io/espressomd/docker/fedora:3388b293a5e8a9b613b1bfa4220e54dfb4bff245-base-layer
image: ghcr.io/espressomd/docker/fedora:4d3e236db5ae334ddcc9c3c82aae7637faa5dabc-base-layer
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand Down
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: ghcr.io/espressomd/docker/ubuntu:3388b293a5e8a9b613b1bfa4220e54dfb4bff245
image: ghcr.io/espressomd/docker/ubuntu:4d3e236db5ae334ddcc9c3c82aae7637faa5dabc

stages:
- prepare
Expand All @@ -16,11 +16,11 @@ stages:

.notification_job_template: &notification_job_definition
<<: *global_job_definition
image: ghcr.io/espressomd/docker/alpine:3388b293a5e8a9b613b1bfa4220e54dfb4bff245
image: ghcr.io/espressomd/docker/alpine:4d3e236db5ae334ddcc9c3c82aae7637faa5dabc
variables:
GET_SOURCES_ATTEMPTS: 3
dependencies: []
timeout: 40m
timeout: 20m
interruptible: false
tags:
- espresso
Expand Down
35 changes: 26 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ endif()
# Python interpreter and Cython interface library
if(ESPRESSO_BUILD_WITH_PYTHON)
find_package(Python 3.11 REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(Cython 3.0.4...<3.2.0 REQUIRED)
find_package(Cython 3.0.4...<4.0.0 REQUIRED)
if(CYTHON_VERSION VERSION_LESS 3.0.8)
message(WARNING "We strongly recommend using Cython 3.0.8 or later")
endif()
Expand Down Expand Up @@ -633,14 +633,14 @@ if(ESPRESSO_BUILD_WITH_SHARED_MEMORY_PARALLELISM)
find_package(OpenMP REQUIRED COMPONENTS CXX)

if(NOT EXISTS ${FETCHCONTENT_BASE_DIR}/kokkos-src)
find_package(Kokkos 4.3 QUIET)
find_package(Kokkos 5.0 QUIET)
endif()
if(NOT DEFINED Kokkos_FOUND OR NOT ${Kokkos_FOUND})
# cmake-format: off
FetchContent_Declare(
kokkos
GIT_REPOSITORY https://github.com/kokkos/kokkos.git
GIT_TAG 18b830e # version 4.6.1 with patches
GIT_TAG 5.0.2
OVERRIDE_FIND_PACKAGE
)
# cmake-format: on
Expand All @@ -652,6 +652,7 @@ if(ESPRESSO_BUILD_WITH_SHARED_MEMORY_PARALLELISM)
set(Kokkos_ENABLE_COMPLEX_ALIGN ON CACHE BOOL "")
set(Kokkos_ENABLE_AGGRESSIVE_VECTORIZATION ON CACHE BOOL "")
set(Kokkos_ENABLE_HWLOC ON CACHE BOOL "")
set(Kokkos_ENABLE_DEPRECATED_CODE_5 OFF CACHE BOOL "")
set(Kokkos_ARCH_NATIVE ON CACHE BOOL "")
FetchContent_MakeAvailable(kokkos)
set(BUILD_SHARED_LIBS ${ESPRESSO_BUILD_SHARED_LIBS_DEFAULT})
Expand Down Expand Up @@ -711,7 +712,7 @@ if(ESPRESSO_BUILD_WITH_HDF5)
FetchContent_Declare(
HighFive
GIT_REPOSITORY https://github.com/highfive-devs/highfive.git
GIT_TAG v3.2.0
GIT_TAG v3.3.0
)
# cmake-format: on
FetchContent_MakeAvailable(HighFive)
Expand Down Expand Up @@ -923,13 +924,14 @@ if(ESPRESSO_BUILD_WITH_WALBERLA)
FetchContent_Declare(
walberla
GIT_REPOSITORY https://i10git.cs.fau.de/walberla/walberla.git
GIT_TAG 17fc54c8 # v7.2 with patches
GIT_TAG 3247aa73 # v7.2 with patches
)
# cmake-format: on
string(REGEX REPLACE "([/\\]walberla)-src$" "\\1-build" walberla_BINARY_DIR
"${walberla_SOURCE_DIR}")
set(WALBERLA_BUILD_TESTS off CACHE BOOL "")
set(WALBERLA_BUILD_TOOLS off CACHE BOOL "")
set(WALBERLA_BUILD_LEGACY_LBM off CACHE BOOL "")
set(WALBERLA_BUILD_BENCHMARKS off CACHE BOOL "")
set(WALBERLA_BUILD_TUTORIALS off CACHE BOOL "")
set(WALBERLA_BUILD_SHOWCASES off CACHE BOOL "")
Expand Down Expand Up @@ -979,7 +981,7 @@ if(ESPRESSO_BUILD_WITH_CALIPER)
FetchContent_Declare(
caliper
GIT_REPOSITORY https://github.com/LLNL/Caliper.git
GIT_TAG v2.13.0
GIT_TAG v2.14.0
)
# cmake-format: on
set(CALIPER_OPTION_PREFIX on CACHE BOOL "")
Expand All @@ -995,10 +997,14 @@ if(ESPRESSO_BUILD_WITH_CALIPER)
set(BUILD_SHARED_LIBS ${ESPRESSO_BUILD_SHARED_LIBS_DEFAULT})
set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_OLD_CMAKE_INSTALL_LIBDIR}")
set(CMAKE_SHARED_LIBRARY_PREFIX "${ESPRESSO_SHARED_LIBRARY_PREFIX}")
add_library(espresso_caliper_compiler_flags INTERFACE)
target_compile_options(
caliper-common
PRIVATE $<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-free-nonheap-object
-Wno-deprecated-enum-enum-conversion -Wno-volatile>)
espresso_caliper_compiler_flags
INTERFACE $<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-free-nonheap-object
-Wno-deprecated-enum-enum-conversion -Wno-volatile
-Wno-maybe-uninitialized>)
target_link_libraries(caliper-common PRIVATE espresso_caliper_compiler_flags)
target_link_libraries(caliper-runtime PRIVATE espresso_caliper_compiler_flags)
endif()

#
Expand Down Expand Up @@ -1028,6 +1034,17 @@ function(espresso_set_common_target_properties)
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE "CXX")
endif()
# handle builds with different GCC versions for C++ and CUDA
# (https://github.com/espressomd/espresso/issues/5256)
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CXX_COMPILER_ID
STREQUAL "GNU"
AND NOT "$ENV{CUDAHOSTCXX}" STREQUAL "$ENV{CXX}"
AND "$ENV{CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}" MATCHES
"^/usr/lib/gcc/[^/]+/1[4-9]\$")
target_link_directories(
${TARGET_NAME} BEFORE PUBLIC
"$ENV{CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES_EXCLUDE}")
endif()
endif()
endif()
endfunction()
Expand Down
1 change: 1 addition & 0 deletions doc/sphinx/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ extensions = [
'sphinx.ext.doctest',
'sphinxcontrib.bibtex',
'sphinx_toggleprompt',
'sphinx_tabs.tabs',
'sphinx.ext.napoleon'
]

Expand Down
103 changes: 84 additions & 19 deletions doc/sphinx/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,20 @@ paths before building the project, for example via environment variables:

.. code-block:: bash

export CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda-12.0"
export CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda-12.8"
export PATH="${CUDA_TOOLKIT_ROOT_DIR}/bin${PATH:+:$PATH}"
export LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

or alternatively via CMake-specific environment variables
(e.g. `ENV{CUDACXX} <https://cmake.org/cmake/help/v4.0/envvar/CUDACXX.html>`__,
`ENV{CUDAARCHS} <https://cmake.org/cmake/help/v4.0/envvar/CUDAARCHS.html>`__,
`ENV{CUDAHOSTCXX} <https://cmake.org/cmake/help/v4.0/envvar/CUDAHOSTCXX.html>`__)
or options (e.g. `-D CUDAToolkit_ROOT <https://cmake.org/cmake/help/v4.0/module/FindCUDAToolkit.html>`__,
`-D CMAKE_CUDA_HOST_COMPILER <https://cmake.org/cmake/help/v4.0/variable/CMAKE_CUDA_HOST_COMPILER.html>`__).

Later in the installation instructions, you will see CMake commands of the form
``cmake ..`` with optional arguments, such as ``cmake .. -D ESPRESSO_BUILD_WITH_CUDA=ON``
``cmake ..`` with optional CUDA-related options and environment variables,
such as ``CUDACXX=/usr/lib/nvidia-cuda-toolkit/bin/nvcc cmake .. -D ESPRESSO_BUILD_WITH_CUDA=ON``
to activate CUDA. These commands may need to be adapted depending on which
operating system and CUDA version you are using.

Expand All @@ -210,39 +218,96 @@ The CMake option ``CMAKE_CUDA_ARCHITECTURES`` cannot be used to set CUDA
architectures, because it has a default value that is too old for the
minimally required CUDA version.

On Ubuntu 24.04, the default GCC compiler may be too recent for nvcc.
You can either use GCC 12:
On Ubuntu 24.04, the default GCC compiler may be too recent for nvcc 12.0.
You can either use GCC 12 or alternatively install Clang 19 as a replacement for nvcc and GCC.

.. code-block:: bash
.. tabs::

CC=gcc-12 CXX=g++-12 CUDACXX=/usr/local/cuda-12.0/bin/nvcc cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON \
-D CUDAToolkit_ROOT=/usr/local/cuda-12.0 \
-D CMAKE_CUDA_FLAGS="--compiler-bindir=/usr/bin/g++-12"
.. group-tab:: GCC on Ubuntu 24.04

or alternatively install Clang 19 as a replacement for nvcc and GCC:
.. code-block:: bash

.. code-block:: bash
CC=gcc-12 CXX=g++-12 CUDACXX=/usr/lib/nvidia-cuda-toolkit/bin/nvcc cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON \
-D CUDAToolkit_ROOT=/usr/lib/nvidia-cuda-toolkit \
-D CMAKE_CUDA_HOST_COMPILER=g++-12

with compiler dependencies:

.. code-block:: bash

sudo apt install gcc-12 g++-12 libstdc++-12-dev

.. group-tab:: Clang on Ubuntu 24.04

CC=clang-19 CXX=clang++-19 CUDACXX=clang++-19 cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON \
-D CUDAToolkit_ROOT=/usr/local/cuda-12.0 \
-D CMAKE_CXX_FLAGS="-I/usr/include/x86_64-linux-gnu/c++/12 -I/usr/include/c++/12 --cuda-path=/usr/local/cuda-12.0" \
-D CMAKE_CUDA_FLAGS="-I/usr/include/x86_64-linux-gnu/c++/12 -I/usr/include/c++/12 --cuda-path=/usr/local/cuda-12.0"
.. code-block:: bash

CC=clang-19 CXX=clang++-19 CUDACXX=clang++-19 cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON \
-D CUDAToolkit_ROOT=/usr/local/cuda-12.0 \
-D CMAKE_CXX_FLAGS="-I/usr/include/x86_64-linux-gnu/c++/12 -I/usr/include/c++/12" \
-D CMAKE_CUDA_FLAGS="-I/usr/include/x86_64-linux-gnu/c++/12 -I/usr/include/c++/12 --cuda-path=/usr/local/cuda-12.0"

with compiler dependencies:

.. code-block:: bash

sudo apt install \
clang-19 clang-tidy-19 clang-format-19 llvm-19 libc++-19-dev \
libclang-rt-19-dev libomp-19-dev gcc-12 g++-12 libstdc++-12-dev

Please note that all CMake options and compiler flags that involve
``/usr/local/cuda-*`` need to be adapted to your CUDA environment.
But they are only necessary on systems with multiple CUDA releases installed,
and can be safely removed if you have only one CUDA release installed.

Please also note that with Clang, you still need the GCC 12 toolchain,
which can be set up with ``apt install gcc-12 g++-12 libstdc++-12-dev``.
Please also note that with Clang, you still need the GCC 12 toolchain.
The extra compiler flags in the Clang CMake command above are needed to pin
the search paths of Clang. By default, it searches trough the most recent
GCC version, which is GCC 13 on Ubuntu 24.04. It is not possible to install
the NVIDIA driver without GCC 13 due to a dependency resolution issue
(``nvidia-dkms`` depends on ``dkms`` which depends on ``gcc-13``).

On Ubuntu 26.04, only GCC <= 13 can be used with nvcc 12.4.
Alternatively, the Clang toolchain can be used.

.. tabs::

.. group-tab:: GCC on Ubuntu 26.04

.. code-block:: bash

CC=gcc-15 CXX=g++-15 CUDAHOSTCXX=g++-13 CUDACXX=/usr/lib/nvidia-cuda-toolkit/bin/nvcc \
CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES_EXCLUDE=/usr/lib/gcc/x86_64-linux-gnu/15 cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON \
-D CUDAToolkit_ROOT=/usr/lib/nvidia-cuda-toolkit

with compiler dependencies:

.. code-block:: bash

sudo apt install \
gcc-13 g++-13 libstdc++-13-dev \
gcc-15 g++-15 libstdc++-15-dev

.. group-tab:: Clang on Ubuntu 26.04

.. code-block:: bash

CC=clang-20 CXX=clang++-20 CUDACXX=clang++-20 cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON \
-D CUDAToolkit_ROOT=/usr/lib/cuda \
-D CMAKE_CXX_FLAGS="-I/usr/include/x86_64-linux-gnu/c++/15 -I/usr/include/c++/15" \
-D CMAKE_CUDA_FLAGS="-I/usr/include/x86_64-linux-gnu/c++/15 -I/usr/include/c++/15 --cuda-path=/usr/lib/cuda"

with compiler dependencies:

.. code-block:: bash

sudo apt install \
clang-20 clang-tidy-20 clang-format-20 llvm-20 libc++-20-dev \
libclang-rt-20-dev libomp-20-dev gcc-15 g++-15 libstdc++-15-dev

.. _Setting up a Jupyter environment:

Setting up a Jupyter environment
Expand Down Expand Up @@ -321,7 +386,7 @@ To generate the Sphinx documentation, install the following packages:
.. code-block:: bash

python3 -m pip install -c requirements.txt \
sphinx sphinxcontrib-bibtex sphinx-toggleprompt
sphinx sphinxcontrib-bibtex sphinx-toggleprompt sphinx-tabs

To generate the Doxygen documentation, install the following packages:

Expand Down
15 changes: 14 additions & 1 deletion maintainer/CI/build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ if [ "${with_cuda}" = true ]; then
fi
fi

if [[ "${OSTYPE}" == "darwin"* ]]; then
# detect libomp on macOS (see https://gitlab.kitware.com/cmake/cmake/-/issues/24097)
cmake_param_list+=(
-D OpenMP_C_FLAG="-Xclang -fopenmp"
-D OpenMP_CXX_FLAG="-Xclang -fopenmp"
-D OpenMP_C_LIB_NAMES=libomp
-D OpenMP_CXX_LIB_NAMES=libomp
-D OpenMP_C_INCLUDE_DIR=/opt/homebrew/opt/libomp/include
-D OpenMP_CXX_INCLUDE_DIR=/opt/homebrew/opt/libomp/include
-D OpenMP_libomp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib
)
fi

# show system characteristics
if test -x "$(command -v nvidia-smi)"; then
nvidia-smi || echo "nvidia-smi returned an error"
Expand Down Expand Up @@ -236,6 +249,7 @@ if [ -f "/etc/os-release" ]; then
--admindir "${HOME}/.local/var/lib/alternatives" \
--install "${HOME}/.local/bin/gcov" "gcov" "${custom_gcov}" 10
fi
export OMPI_MCA_mpi_abort_print_stack=enabled
fi
fi

Expand Down Expand Up @@ -386,7 +400,6 @@ if [ "${with_coverage}" = true ] || [ "${with_coverage_python}" = true ]; then
echo "Running lcov and gcov..."
codecov_opts="${codecov_opts} --gcov"
"${srcdir}/maintainer/CI/run_lcov.sh" coverage.info
rm coverage.info
fi
if [ "${with_coverage_python}" = true ]; then
echo "Running python3-coverage..."
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ coverage>=7.4.4
sphinx>=7.2.6
sphinx-toggleprompt==0.5.2
sphinxcontrib-bibtex>=2.6.2
sphinx-tabs>=3.4.4
numpydoc>=1.6.0
pybtex>=0.24.0
# jupyter dependencies
Expand Down
Loading