Skip to content

Commit

Permalink
Rename project build options and bump all requirements (#4612)
Browse files Browse the repository at this point in the history
Fixes #4618

We have concrete plans to integrate more external libraries into ESPResSo, such as waLBerla for hydrodynamics and librepa+kdpart for MD load balancing. We opted for the CMake `FetchContent` method, which allows us to finely tune the way these libraries are compiled and integrated into ESPResSo. However, our build system has imperfections that makes it difficult to integrate new libraries, or to use ESPResSo as a library in a parent project. In particular, CMake flags such as `WITH_FFTW` are inherited by included projects, which sometimes cause them to build components that are not needed in ESPResSo. This unnecessarily increases build times, and in a few cases, forces users to install extra dependencies to complete the build.

It is good practice to put a project-specific prefix on all CMake options to avoid this kind of name conflict. While we worked with external libraries maintainers to rename their CMake options, we obviously need to rename ESPResSo CMake options too. As such, this PR adds a prefix `ESPRESSO_BUILD_` to all options that control compilation, and a prefix `ESPRESSO_` to the other options. The new option names can be found in the user guide, section 2.4.4. "Options and Variables".

Since the waLBerla project requires C++17, and CUDA versions 10.x only support C++14, we will be migrating to C++17 and CUDA 11.x. This change is also motivated by the `thrust` library, which generates compiler warnings for certain containers until CUDA 11.5, and Cython which now uses C++17 by default in Ubuntu 22.04.

Description of changes:
- rename ESPResSo-specific CMake options and functions
   - e.g. for build options: `-D WITH_CUDA=ON` becomes `-D ESPRESSO_BUILD_WITH_CUDA=ON`
   - e.g. for other options: `-D CTEST_ARGS=-j16` becomes `-D ESPRESSO_CTEST_ARGS=-j16`
- require a C++17-capable compiler
   - replace 400 lines of code in the core by equivalent STL functions
   - reduce usage of Boost algorithms
   - check the project builds without external dependencies in C++20 mode
- bump all version requirements
   - CMake >= 3.18, Python >= 3.9, Cython >= 0.29.21, Boost >= 1.74, CUDA >= 11.0, OpenMPI >= 4.0, MPICH >= 3.4.1, GCC >= 8.0, Clang >= 9.0.0, AppleClang >= 11.0.0, Intel Classic >= 18.0, Intel oneAPI >= 2021.0
   - Python package version requirements are based on versions available in Ubuntu 22.04 and Debian 11
- `FindCython` now stops CMake generation when Cython was not found
  • Loading branch information
kodiakhq[bot] authored Dec 5, 2022
2 parents e1d0e49 + d91bb12 commit 1970f48
Show file tree
Hide file tree
Showing 172 changed files with 1,096 additions and 1,378 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build_and_check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
pip3 install numpy cython h5py scipy
shell: bash
- run: |
export myconfig=maxset with_cuda=false test_timeout=800 with_asan=${{ inputs.asan }} with_ubsan=${{ inputs.ubsan }} check_skip_long=true build_procs=2 check_procs=2
export myconfig=maxset with_cuda=false with_gsl=false test_timeout=800 with_asan=${{ inputs.asan }} with_ubsan=${{ inputs.ubsan }} check_skip_long=true build_procs=2 check_procs=2
bash maintainer/CI/build_cmake.sh
shell: bash
# This is a workaround for the unfortunate interaction of MacOS and OpenMPI 4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push_pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'
- name: Check without sanitizer
uses: ./.github/actions/build_and_check
with:
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'
- name: Check with sanitizer
uses: ./.github/actions/build_and_check
with:
Expand Down
120 changes: 57 additions & 63 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: ghcr.io/espressomd/docker/ubuntu-20.04:efd89c5f66b8a65f579a7807d0059939fcb4b12f
image: ghcr.io/espressomd/docker/ubuntu-22.04:3fd42369f84239b8c4f5d77067d404789c55ff44

stages:
- prepare
Expand Down Expand Up @@ -68,7 +68,7 @@ style_doxygen:
- mkdir build
- cd build
- cp ../maintainer/configs/maxset.hpp myconfig.hpp
- cmake .. -DWITH_CUDA=ON -DWITH_SCAFACOS=ON
- cmake .. -D ESPRESSO_BUILD_WITH_CUDA=ON -D ESPRESSO_BUILD_WITH_GSL=ON -D ESPRESSO_BUILD_WITH_HDF5=ON -D ESPRESSO_BUILD_WITH_SCAFACOS=ON -D ESPRESSO_BUILD_WITH_STOKESIAN_DYNAMICS=ON
- sh ../maintainer/CI/dox_warnings.sh
tags:
- espresso
Expand All @@ -80,8 +80,9 @@ default:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-9'
CXX: 'g++-9'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
with_cuda: 'false'
myconfig: 'default'
with_coverage: 'true'
Expand All @@ -98,16 +99,17 @@ maxset:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-9'
CXX: 'g++-9'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
with_cuda: 'false'
with_cxx_standard: '17'
with_cxx_standard: '20'
myconfig: 'maxset'
with_coverage: 'true'
with_scafacos: 'true'
with_stokesian_dynamics: 'true'
check_skip_long: 'true'
cmake_params: '-DTEST_NP=8'
cmake_params: '-D ESPRESSO_TEST_NP=8'
script:
- bash maintainer/CI/build_cmake.sh
tags:
Expand All @@ -119,8 +121,9 @@ no_rotation:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-9'
CXX: 'g++-9'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
with_cuda: 'false'
myconfig: 'no_rotation'
with_coverage: 'true'
Expand All @@ -136,11 +139,13 @@ no_rotation:
ubuntu:wo-dependencies:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:efd89c5f66b8a65f579a7807d0059939fcb4b12f
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:3fd42369f84239b8c4f5d77067d404789c55ff44
variables:
myconfig: 'maxset'
with_cuda: 'false'
with_hdf5: 'false'
with_fftw: 'false'
with_gsl: 'false'
make_check_unit_tests: 'false'
make_check_python: 'false'
script:
Expand All @@ -154,9 +159,10 @@ ubuntu:wo-dependencies:
debian:10:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/debian:efd89c5f66b8a65f579a7807d0059939fcb4b12f
image: ghcr.io/espressomd/docker/debian:3fd42369f84239b8c4f5d77067d404789c55ff44
variables:
with_cuda: 'false'
with_gsl: 'false'
myconfig: 'maxset'
make_check_python: 'false'
with_stokesian_dynamics: 'true'
Expand All @@ -169,9 +175,10 @@ debian:10:
fedora:36:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/fedora:efd89c5f66b8a65f579a7807d0059939fcb4b12f
image: ghcr.io/espressomd/docker/fedora:3fd42369f84239b8c4f5d77067d404789c55ff44
variables:
with_cuda: 'false'
with_gsl: 'false'
myconfig: 'maxset'
make_check_python: 'true'
with_stokesian_dynamics: 'true'
Expand All @@ -187,8 +194,8 @@ clang-sanitizer:
<<: *global_job_definition
stage: build
variables:
CC: 'clang-9'
CXX: 'clang++-9'
CC: 'clang-14'
CXX: 'clang++-14'
myconfig: 'maxset'
with_cuda: 'true'
with_cuda_compiler: 'clang'
Expand All @@ -210,10 +217,10 @@ clang-sanitizer:
fast_math:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/cuda:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
CC: 'gcc-9'
CXX: 'g++-9'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
myconfig: 'maxset'
with_cuda: 'true'
with_coverage: 'false'
Expand All @@ -227,31 +234,9 @@ fast_math:
- cuda
when: manual

cuda11-maxset-ubuntu20.04:
cuda11-coverage:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/cuda:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
CC: 'gcc-9'
CXX: 'g++-9'
GCOV: 'gcov-9'
myconfig: 'maxset'
with_cuda: 'true'
with_coverage: 'true'
check_skip_long: 'true'
with_scafacos: 'true'
with_stokesian_dynamics: 'true'
script:
- bash maintainer/CI/build_cmake.sh
tags:
- espresso
- cuda
- numa

cuda11-maxset-ubuntu22.04:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/ubuntu-22.04:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
CC: 'gcc-10'
CXX: 'g++-10'
Expand All @@ -269,12 +254,13 @@ cuda11-maxset-ubuntu22.04:
- cuda
- numa

cuda10-maxset:
cuda11-maxset:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-8'
CXX: 'g++-8'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
myconfig: 'maxset'
with_cuda: 'true'
with_coverage: 'false'
Expand All @@ -298,8 +284,9 @@ tutorials-samples-maxset:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-8'
CXX: 'g++-8'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
myconfig: 'maxset'
with_cuda: 'true'
with_coverage: 'false'
Expand All @@ -316,13 +303,15 @@ tutorials-samples-maxset:
tags:
- espresso
- cuda
- numa

tutorials-samples-default:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-8'
CXX: 'g++-8'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
myconfig: 'default'
with_cuda: 'true'
with_coverage: 'false'
Expand All @@ -338,15 +327,17 @@ tutorials-samples-default:
tags:
- espresso
- cuda
- numa
only:
- schedules

tutorials-samples-empty:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-8'
CXX: 'g++-8'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
myconfig: 'empty'
with_cuda: 'true'
with_coverage: 'false'
Expand All @@ -363,15 +354,17 @@ tutorials-samples-empty:
tags:
- espresso
- cuda
- numa
only:
- schedules

tutorials-samples-no-gpu:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-8'
CXX: 'g++-8'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
myconfig: 'maxset'
with_cuda: 'true'
with_coverage: 'false'
Expand All @@ -395,8 +388,9 @@ installation:
<<: *global_job_definition
stage: build
variables:
CC: 'gcc-8'
CXX: 'g++-8'
CC: 'gcc-10'
CXX: 'g++-10'
GCOV: 'gcov-10'
myconfig: 'maxset'
with_cuda: 'true'
with_coverage: 'false'
Expand All @@ -413,7 +407,7 @@ installation:
# get path of installed files
- CI_INSTALL_DIR="/tmp/espresso-unit-tests"
- CI_INSTALL_PYTHON_PATH=$(dirname $(find "${CI_INSTALL_DIR}/lib" -name espressomd))
- CI_CORES=$(cmake -L . | grep CTEST_ARGS | grep --color=never -Po '(?<=-j)[0-9]+')
- CI_CORES=$(cmake -L . | grep ESPRESSO_CTEST_ARGS | grep --color=never -Po '(?<=-j)[0-9]+')
# deploy object-in-fluid module
- cp -r "src/python/object_in_fluid" "${CI_INSTALL_PYTHON_PATH}/object_in_fluid"
# run all tests with the installed files
Expand All @@ -430,8 +424,8 @@ empty:
<<: *global_job_definition
stage: build
variables:
CC: 'clang-9'
CXX: 'clang++-9'
CC: 'clang-14'
CXX: 'clang++-14'
myconfig: 'empty'
with_cuda: 'true'
with_cuda_compiler: 'clang'
Expand All @@ -451,7 +445,7 @@ check_sphinx:
<<: *global_job_definition
stage: additional_checks
needs:
- cuda10-maxset
- cuda11-maxset
when: on_success
script:
- cd ${CI_PROJECT_DIR}/build
Expand All @@ -473,7 +467,7 @@ run_tutorials:
<<: *global_job_definition
stage: additional_checks
needs:
- cuda10-maxset
- cuda11-maxset
when: on_success
script:
- cd ${CI_PROJECT_DIR}/build
Expand All @@ -499,7 +493,7 @@ run_doxygen:
<<: *global_job_definition
stage: additional_checks
needs:
- cuda10-maxset
- cuda11-maxset
when: on_success
only:
- python
Expand All @@ -520,7 +514,7 @@ maxset_no_gpu:
stage: additional_checks
when: on_success
needs:
- cuda10-maxset
- cuda11-maxset
script:
- export CUDA_VISIBLE_DEVICES=""
- cd ${CI_PROJECT_DIR}/build
Expand All @@ -535,10 +529,10 @@ maxset_3_cores:
stage: additional_checks
when: on_success
needs:
- cuda10-maxset
- cuda11-maxset
script:
- cd ${CI_PROJECT_DIR}/build
- cmake -DTEST_NP=3 .
- cmake -D ESPRESSO_TEST_NP=3 .
- make -t && make check_unit_tests && make check_python_parallel_odd
tags:
- espresso
Expand Down
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tasks:
command: |
mkdir build
cd build
cmake .. -D WITH_GSL=ON
cmake .. -D ESPRESSO_BUILD_WITH_GSL=ON
make
make tutorials
for f in doc/tutorials/*/*.ipynb; do echo "configuring ${f}"; ./pypresso doc/tutorials/convert.py exercise2 --to-vscode-jupyter ${f}; done
Expand Down
Loading

0 comments on commit 1970f48

Please sign in to comment.