[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Build system changes in the python branch: C++20, CUDA 12, CMake 3.25.1
From: |
Jean-Noël Grad |
Subject: |
Build system changes in the python branch: C++20, CUDA 12, CMake 3.25.1 |
Date: |
Tue, 25 Jun 2024 20:29:02 +0200 |
User-agent: |
Mozilla Thunderbird |
Dear users,
We would like to share with you some important changes to the way the
development version of ESPResSo is configured and built.
The python branch of ESPResSo now requires a C++20-capable compiler and
CUDA 12. We strongly recommend CUDA 12.1+, and either GCC 11+, Clang 18+
or AppleClang 15+. Clang 18 isn't widely available in package managers
yet, but can be built from sources with the attached shell script. GCC
13 users may have to add `-allow-unsupported-compiler` to the
CMAKE_CUDA_FLAGS variable. The waLBerla/PyStencils/LbmPy version
requirements were also updated.
CMake 3.25.1 (or higher) is now required. If a suitable version isn't
available in your operating system package manager, a local installation
can be carried out with `python3 -m pip install cmake==3.25.2`. The
binaries will be stored in an OS-dependent folder, such as
`~/.local/bin` on Ubuntu, which needs to be in your $PATH environment
variable. It is best to use a Python virtual environment to isolate your
Python dependencies and automatically set up environment variables;
instructions are available on our wiki
(https://github.com/espressomd/espresso/wiki/Tooling#environments).
When checking out the new code, please build from scratch in a fresh
folder, since CMake won't be able to update your old build folders. When
multiple compilers or CUDA toolkits are available on your system, and
CMake selects the incorrect ones, you can pin the desired versions in
the command line arguments using one of the examples below:
# GCC + NVCC compiler toolchain
GCC_VER=11; CUDA_VER=12.0; CC=gcc-${GCC_VER} CXX=g++-${GCC_VER}
CUDACXX=/usr/local/cuda-${CUDA_VER}/bin/nvcc CUDAARCHS="61;75;86" cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON -D
CUDAToolkit_ROOT=/usr/local/cuda-${CUDA_VER} \
-D ESPRESSO_BUILD_WITH_WALBERLA=ON -D
ESPRESSO_BUILD_WITH_WALBERLA_AVX=ON \
-D CMAKE_CUDA_FLAGS="--compiler-bindir=/usr/bin/g++-${GCC_VER}"
# alternative: Clang compiler toolchain
GCC_VER=11; CUDA_VER=12.0; CLANG_VER=18; CC=clang-${CLANG_VER}
CXX=clang++-${CLANG_VER} CUDACXX=clang++-${CLANG_VER}
CUDAARCHS="61;75;86" cmake .. \
-D ESPRESSO_BUILD_WITH_CUDA=ON -D
CUDAToolkit_ROOT="/usr/local/cuda-${CUDA_VER}" \
-D CMAKE_CXX_FLAGS=" -I/usr/include/x86_64-linux-gnu/c++/${GCC_VER}/
-I/usr/include/c++/${GCC_VER}
--gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/${GCC_VER}" \
-D CMAKE_CUDA_FLAGS="-I/usr/include/x86_64-linux-gnu/c++/${GCC_VER}/
-I/usr/include/c++/${GCC_VER}
--gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/${GCC_VER}
--cuda-path=/usr/local/cuda-${CUDA_VER}" \
-D
CMAKE_SHARED_LINKER_FLAGS="-Wl,-L/usr/lib/gcc/x86_64-linux-gnu/${GCC_VER}" \
-D
CMAKE_EXE_LINKER_FLAGS="-Wl,-L/usr/lib/gcc/x86_64-linux-gnu/${GCC_VER}" \
-D ESPRESSO_BUILD_WITH_WALBERLA=ON -D
ESPRESSO_BUILD_WITH_WALBERLA_AVX=ON \
-D ESPRESSO_BUILD_WITH_CLANG_TIDY=ON
The ESPResSo core is now leveraging most of the new features from C++20:
std::span, std::numbers, std::ranges, range-based algorithms, concepts,
and quality-of-life improvements in STL containers. Some of these
features were historically available in ESPResSo as utils/Span.hpp, as
utils/constants.hpp or as Boost libraries, but have now been fully
replaced by equivalent STL functionality.
We expect contributions to the C++, CUDA and CMake code of ESPResSo to
be a lot easier moving forward, especially to newcomers.
Best regards,
Jean-Noël Grad
clang-install.sh.txt
Description: Text document
- Build system changes in the python branch: C++20, CUDA 12, CMake 3.25.1,
Jean-Noël Grad <=