Skip to content

Commit 6834a00

Browse files
authored
CMake: Replace FetchContent_Populate (#5179)
* CMake: Replace `FetchContent_Populate` In CMake superbuilds, `FetchContent_Populate` is now deprecated. Use `FetchContent_MakeAvailable` instead. * CI: Catalyst Image Update (CMake) Update the Catalyst CI image to `kitware/paraview:ci-catalyst-amrex-warpx-20240828` to pull in a newer CMake version with it. * CI: SENSEI Hack CMake Update Hack into container image. * Doc: CMake 3.24+ - dependencies/requirements - system docs * HPC3: CMake via `pipx` for now Ticket still pending completion.
1 parent a4fbb13 commit 6834a00

17 files changed

+44
-66
lines changed

.github/workflows/insitu.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
image: senseiinsitu/ci:fedora35-amrex-20220613
2323
steps:
2424
- uses: actions/checkout@v4
25+
- name: Setup cmake
26+
uses: jwlawson/actions-setup-cmake@v2
2527
- name: Configure
2628
run: |
2729
cmake -S . -B build \
@@ -73,7 +75,7 @@ jobs:
7375

7476
catalyst:
7577
name: Catalyst
76-
runs-on: ubuntu-20.04
78+
runs-on: ubuntu-22.04
7779
if: github.event.pull_request.draft == false
7880
env:
7981
CXX: g++
@@ -83,8 +85,10 @@ jobs:
8385
CATALYST_IMPLEMENTATION_PATHS: /opt/paraview/lib/catalyst
8486
OMP_NUM_THREADS: 1
8587

88+
# Container build scripts:
89+
# https://gitlab.kitware.com/christos.tsolakis/catalyst-amrex-docker-images
8690
container:
87-
image: kitware/paraview:ci-catalyst-amrex-warpx-20240701
91+
image: kitware/paraview:ci-catalyst-amrex-warpx-20240828
8892
steps:
8993
- uses: actions/checkout@v4
9094
- name: Configure

CMakeLists.txt

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Preamble ####################################################################
22
#
3-
cmake_minimum_required(VERSION 3.20.0)
3+
cmake_minimum_required(VERSION 3.24.0)
44
project(WarpX VERSION 24.08)
55

66
include(${WarpX_SOURCE_DIR}/cmake/WarpXFunctions.cmake)
@@ -29,13 +29,6 @@ if(POLICY CMP0104)
2929
cmake_policy(SET CMP0104 OLD)
3030
endif()
3131

32-
# We use simple syntax in cmake_dependent_option, so we are compatible with the
33-
# extended syntax in CMake 3.22+
34-
# https://cmake.org/cmake/help/v3.22/policy/CMP0127.html
35-
if(POLICY CMP0127)
36-
cmake_policy(SET CMP0127 NEW)
37-
endif()
38-
3932

4033
# C++ Standard in Superbuilds #################################################
4134
#

Docs/source/install/dependencies.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WarpX depends on the following popular third party software.
77
Please see installation instructions below.
88

99
- a mature `C++17 <https://en.wikipedia.org/wiki/C%2B%2B17>`__ compiler, e.g., GCC 8.4+, Clang 7, NVCC 11.0, MSVC 19.15 or newer
10-
- `CMake 3.20.0+ <https://cmake.org>`__
10+
- `CMake 3.24.0+ <https://cmake.org>`__
1111
- `Git 2.18+ <https://git-scm.com>`__
1212
- `AMReX <https://amrex-codes.github.io>`__: we automatically download and compile a copy of AMReX
1313
- `PICSAR <https://github.com/ECP-WarpX/picsar>`__: we automatically download and compile a copy of PICSAR

Tools/machines/frontier-olcf/frontier_warpx.profile.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export MY_PROFILE=$(cd $(dirname $BASH_SOURCE) && pwd)"/"$(basename $BASH_SOURCE
66
if [ -z ${proj-} ]; then echo "WARNING: The 'proj' variable is not yet set in your $MY_PROFILE file! Please edit its line 2 to continue!"; return; fi
77

88
# required dependencies
9-
module load cmake/3.23.2
9+
module switch Core Core/24.07
10+
module load cmake/3.27.9
1011
module load craype-accel-amd-gfx90a
1112
module load rocm/5.7.1
1213
module load cray-mpich/8.1.28

Tools/machines/hpc3-uci/hpc3_gpu_warpx.profile.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export MY_PROFILE=$(cd $(dirname $BASH_SOURCE) && pwd)"/"$(basename $BASH_SOURCE
66
if [ -z ${proj-} ]; then echo "WARNING: The 'proj' variable is not yet set in your $MY_PROFILE file! Please edit its line 2 to continue!"; return; fi
77

88
# required dependencies
9-
module load cmake/3.22.1
9+
module load cmake/3.22.1 # we need 3.24+ - installing via pipx until module is available
1010
module load gcc/11.2.0
1111
module load cuda/11.7.1
1212
module load openmpi/4.1.2/gcc.11.2.0

Tools/machines/hpc3-uci/install_gpu_dependencies.sh

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ python3 -m pip install --upgrade build
118118
python3 -m pip install --upgrade packaging
119119
python3 -m pip install --upgrade wheel
120120
python3 -m pip install --upgrade setuptools
121+
python3 -m pip install --upgrade pipx
122+
python3 -m pipx install --upgrade cmake
121123
python3 -m pip install --upgrade cython
122124
python3 -m pip install --upgrade numpy
123125
python3 -m pip install --upgrade pandas

Tools/machines/lassen-llnl/lassen_v100_warpx_toss3.profile.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#export proj="<yourProjectNameHere>" # edit this and comment in
33

44
# required dependencies
5-
module load cmake/3.23.1
5+
module load cmake/3.29.2
66
module load gcc/11.2.1
77
module load cuda/12.0.0
88

Tools/machines/ookami-sbu/ookami_warpx.profile.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#export proj=<yourProject>
33

44
# required dependencies
5-
module load cmake/3.19.0
5+
module load cmake/3.19.0 # please check for a 3.24+ module and report back
66
module load gcc/10.3.0
77
module load openmpi/gcc10/4.1.0
88

Tools/machines/polaris-alcf/polaris_gpu_warpx.profile.example

+11-7
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@ export proj="" # change me!
33

44
# swap to GNU programming environment (with gcc 11.2)
55
module swap PrgEnv-nvhpc PrgEnv-gnu
6-
module swap gcc/12.2.0 gcc/11.2.0
7-
module load nvhpc-mixed/22.11
6+
module load gcc-native/12.3
7+
module load nvhpc-mixed/23.9
88

99
# swap to the Milan cray package
10-
module swap craype-x86-rome craype-x86-milan
10+
module load craype-x86-milan
11+
12+
# extra modules
13+
module use /soft/modulefiles
14+
module load spack-pe-gnu
1115

1216
# required dependencies
13-
module load cmake/3.23.2
17+
module load cmake/3.27.7
1418

1519
# optional: for QED support with detailed tables
16-
# module load boost/1.81.0
20+
module load boost
1721

1822
# optional: for openPMD and PSATD+RZ support
19-
module load cray-hdf5-parallel/1.12.2.3
23+
module load cray-hdf5-parallel/1.12.2.9
2024
export CMAKE_PREFIX_PATH=/home/${USER}/sw/polaris/gpu/c-blosc-1.21.1:$CMAKE_PREFIX_PATH
2125
export CMAKE_PREFIX_PATH=/home/${USER}/sw/polaris/gpu/adios2-2.8.3:$CMAKE_PREFIX_PATH
2226
export CMAKE_PREFIX_PATH=/home/${USER}/sw/polaris/gpu/blaspp-2024.05.31:$CMAKE_PREFIX_PATH
@@ -30,7 +34,7 @@ export LD_LIBRARY_PATH=/home/${USER}/sw/polaris/gpu/lapackpp-2024.05.31/lib64:$L
3034
export PATH=/home/${USER}/sw/polaris/gpu/adios2-2.8.3/bin:${PATH}
3135

3236
# optional: for Python bindings or libEnsemble
33-
module load cray-python/3.9.13.1
37+
module load python/3.10.9
3438

3539
if [ -d "/home/${USER}/sw/polaris/gpu/venvs/warpx" ]
3640
then

Tools/machines/taurus-zih/taurus_warpx.profile.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module load modenv/hiera
66
module load foss/2021b
77
module load CUDA/11.8.0
8-
module load CMake/3.22.1
8+
module load CMake/3.27.6
99

1010
# optional: for QED support with detailed tables
1111
#module load Boost # TODO

cmake/dependencies/AMReX.cmake

+6-11
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,17 @@ macro(find_amrex)
145145
endif()
146146
add_subdirectory(${WarpX_amrex_src} _deps/localamrex-build/)
147147
else()
148+
if(WarpX_COMPUTE STREQUAL CUDA)
149+
enable_language(CUDA)
150+
# AMReX 21.06+ supports CUDA_ARCHITECTURES
151+
endif()
148152
FetchContent_Declare(fetchedamrex
149153
GIT_REPOSITORY ${WarpX_amrex_repo}
150154
GIT_TAG ${WarpX_amrex_branch}
151155
BUILD_IN_SOURCE 0
152156
)
153-
FetchContent_GetProperties(fetchedamrex)
154-
155-
if(NOT fetchedamrex_POPULATED)
156-
FetchContent_Populate(fetchedamrex)
157-
list(APPEND CMAKE_MODULE_PATH "${fetchedamrex_SOURCE_DIR}/Tools/CMake")
158-
if(WarpX_COMPUTE STREQUAL CUDA)
159-
enable_language(CUDA)
160-
# AMReX 21.06+ supports CUDA_ARCHITECTURES
161-
endif()
162-
add_subdirectory(${fetchedamrex_SOURCE_DIR} ${fetchedamrex_BINARY_DIR})
163-
endif()
157+
FetchContent_MakeAvailable(fetchedamrex)
158+
list(APPEND CMAKE_MODULE_PATH "${fetchedamrex_SOURCE_DIR}/Tools/CMake")
164159

165160
# advanced fetch options
166161
mark_as_advanced(FETCHCONTENT_BASE_DIR)

cmake/dependencies/PICSAR.cmake

+4-10
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,13 @@ function(find_picsar)
5353
get_source_version(PXRMP_QED ${WarpX_picsar_src})
5454
else()
5555
FetchContent_Declare(fetchedpicsar
56-
GIT_REPOSITORY ${WarpX_picsar_repo}
57-
GIT_TAG ${WarpX_picsar_branch}
56+
GIT_REPOSITORY ${WarpX_picsar_repo}
57+
GIT_TAG ${WarpX_picsar_branch}
5858
BUILD_IN_SOURCE 0
59+
SOURCE_SUBDIR multi_physics/QED
5960
)
60-
FetchContent_GetProperties(fetchedpicsar)
61+
FetchContent_MakeAvailable(fetchedpicsar)
6162

62-
if(NOT fetchedpicsar_POPULATED)
63-
FetchContent_Populate(fetchedpicsar)
64-
add_subdirectory(
65-
${fetchedpicsar_SOURCE_DIR}/multi_physics/QED
66-
${fetchedpicsar_BINARY_DIR}
67-
)
68-
endif()
6963
get_source_version(PXRMP_QED ${fetchedpicsar_SOURCE_DIR})
7064
if(NOT PXRMP_QED_GIT_VERSION)
7165
set(PXRMP_QED_GIT_VERSION "${WarpX_picsar_branch}" CACHE INTERNAL "")

cmake/dependencies/openPMD.cmake

+1-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ function(find_openpmd)
3232
GIT_TAG ${WarpX_openpmd_branch}
3333
BUILD_IN_SOURCE 0
3434
)
35-
FetchContent_GetProperties(fetchedopenpmd)
36-
37-
if(NOT fetchedopenpmd_POPULATED)
38-
FetchContent_Populate(fetchedopenpmd)
39-
add_subdirectory(${fetchedopenpmd_SOURCE_DIR} ${fetchedopenpmd_BINARY_DIR})
40-
endif()
35+
FetchContent_MakeAvailable(fetchedopenpmd)
4136

4237
# advanced fetch options
4338
mark_as_advanced(FETCHCONTENT_BASE_DIR)

cmake/dependencies/pyAMReX.cmake

+1-6
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ function(find_pyamrex)
4747
GIT_TAG ${WarpX_pyamrex_branch}
4848
BUILD_IN_SOURCE 0
4949
)
50-
FetchContent_GetProperties(fetchedpyamrex)
51-
52-
if(NOT fetchedpyamrex_POPULATED)
53-
FetchContent_Populate(fetchedpyamrex)
54-
add_subdirectory(${fetchedpyamrex_SOURCE_DIR} ${fetchedpyamrex_BINARY_DIR})
55-
endif()
50+
FetchContent_MakeAvailable(fetchedpyamrex)
5651

5752
# advanced fetch options
5853
mark_as_advanced(FETCHCONTENT_BASE_DIR)

cmake/dependencies/pybind11.cmake

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ function(find_pybind11)
2121
GIT_TAG ${WarpX_pybind11_branch}
2222
BUILD_IN_SOURCE 0
2323
)
24-
FetchContent_GetProperties(fetchedpybind11)
25-
26-
if(NOT fetchedpybind11_POPULATED)
27-
FetchContent_Populate(fetchedpybind11)
28-
add_subdirectory(${fetchedpybind11_SOURCE_DIR} ${fetchedpybind11_BINARY_DIR})
29-
endif()
24+
FetchContent_MakeAvailable(fetchedpybind11)
3025

3126
# advanced fetch options
3227
mark_as_advanced(FETCHCONTENT_BASE_DIR)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
requires = [
33
"setuptools>=42",
44
"wheel",
5-
"cmake>=3.20.0,<4.0.0",
5+
"cmake>=3.24.0,<4.0.0",
66
"packaging>=23",
77
]
88
build-backend = "setuptools.build_meta"

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ def run(self):
6363
out = subprocess.check_output(["cmake", "--version"])
6464
except OSError:
6565
raise RuntimeError(
66-
"CMake 3.20.0+ must be installed to build the following "
66+
"CMake 3.24.0+ must be installed to build the following "
6767
+ "extensions: "
6868
+ ", ".join(e.name for e in self.extensions)
6969
)
7070

7171
cmake_version = parse(re.search(r"version\s*([\d.]+)", out.decode()).group(1))
72-
if cmake_version < parse("3.20.0"):
73-
raise RuntimeError("CMake >= 3.20.0 is required")
72+
if cmake_version < parse("3.24.0"):
73+
raise RuntimeError("CMake >= 3.24.0 is required")
7474

7575
for ext in self.extensions:
7676
self.build_extension(ext)

0 commit comments

Comments
 (0)