diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 70ec20cb..bb347a33 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -301,7 +301,7 @@ jobs: -DAMReX_SPACEDIM="1;2;3" \ -DCMAKE_CUDA_STANDARD=17 \ -DCMAKE_CXX_STANDARD=17 \ - -DAMReX_CUDA_ARCH=8.0 \ + -DCMAKE_CUDA_ARCHITECTURES=80 \ -DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON \ -DAMReX_CUDA_ERROR_CAPTURE_THIS=ON cmake --build build --target pip_install -j 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 08e8051c..df5f3b87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ string(JSON pyamrex_version GET "${dependencies_data}" version_pyamrex) # Preamble #################################################################### # -cmake_minimum_required(VERSION 3.24.0) +cmake_minimum_required(VERSION 3.25.0) project(pyAMReX VERSION ${pyamrex_version}) include(${pyAMReX_SOURCE_DIR}/cmake/pyAMReXFunctions.cmake) @@ -26,11 +26,6 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) endif() -# CMake 3.18+: CMAKE_CUDA_ARCHITECTURES -# https://cmake.org/cmake/help/latest/policy/CMP0104.html -if(POLICY CMP0104) - cmake_policy(SET CMP0104 OLD) -endif() # device link step not yet fully implemented in AMReX logic # https://cmake.org/cmake/help/latest/policy/CMP0105.html if(POLICY CMP0105) diff --git a/dependencies.json b/dependencies.json index 090e2dc0..ea4e1139 100644 --- a/dependencies.json +++ b/dependencies.json @@ -2,6 +2,6 @@ "version_pyamrex": "26.08", "version_amrex": "26.08", "version_pybind11_min": "v3.0.0", - "commit_amrex": "5273b558c13011573e1b6bf71860db4fcc1f0cfb", + "commit_amrex": "06424932b7572c829ca9fe31a6e178c164bf232c", "commit_pybind11": "v3.1.0" } diff --git a/docs/source/install/cmake.rst b/docs/source/install/cmake.rst index 3430cce2..7714b74b 100644 --- a/docs/source/install/cmake.rst +++ b/docs/source/install/cmake.rst @@ -82,6 +82,7 @@ CMake Option Default & Values Des =============================== ============================================ =========================================================== ``BUILD_TESTING`` **ON**/OFF Build tests ``CMAKE_BUILD_TYPE`` RelWithDebInfo/**Release**/Debug Type of build, symbols & optimizations +``CMAKE_CUDA_ARCHITECTURES`` **native**/all/all-major/``80``/... Nvidia GPU architectures to compile for (``AMReX_GPU_BACKEND=CUDA``) ``CMAKE_INSTALL_PREFIX`` system-dependent path Install path prefix ``CMAKE_VERBOSE_MAKEFILE`` ON/**OFF** Print all compiler commands to the terminal during build ``AMReX_OMP`` ON/**OFF** Enable OpenMP @@ -160,6 +161,37 @@ If you also want to select a CUDA compiler: Now call ``cmake -S . -B build`` (+ further options) again to re-initialize the build configuration. +.. _building-cmake-gpu-archs: + +Select GPU Architectures +------------------------ + +For Nvidia GPUs, pyAMReX uses the standard CMake interface to select the CUDA architectures to compile for. +By default, we select ``native``, i.e., CMake detects the architecture of the GPU(s) visible on the machine that runs ``cmake`` and pyAMReX is built exactly for those. + +If no GPU is visible at configuration time (a typical situation on HPC login nodes, in containers and in CI) then configuration stops with an error and you need to select the architecture explicitly, either as a CMake option: + +.. code-block:: bash + + cmake -S . -B build -DAMReX_GPU_BACKEND=CUDA -DCMAKE_CUDA_ARCHITECTURES=80 + +or as an `environment variable `__: + +.. code-block:: bash + + export CUDAARCHS=80 + +Architectures are written as integers, e.g., ``80`` for A100 (compute capability 8.0) and ``90`` for H100. +`Multiple architectures `__ are separated by semicolons (``"80;90"``), and the special values ``native``, ``all`` and ``all-major`` are supported as well. + +.. note:: + + The older AMReX-specific spellings ``-DAMReX_CUDA_ARCH=8.0`` and ``export AMREX_CUDA_ARCH=8.0`` still work, but are deprecated and warn. + They are translated to the CMake variables above, including their historical value formats (``Auto``, ``Common``, ``Volta``, ``8.0``, ``7.0+PTX``, whitespace-separated lists). + +For AMD GPUs, select the architecture with ``-DAMReX_AMD_ARCH=gfx90a`` or ``export AMREX_AMD_ARCH=gfx90a``. + + Run --- diff --git a/docs/source/install/dependencies.rst b/docs/source/install/dependencies.rst index f37a44fb..b92db191 100644 --- a/docs/source/install/dependencies.rst +++ b/docs/source/install/dependencies.rst @@ -7,7 +7,7 @@ pyAMReX depends on the following popular third party software. Please see installation instructions below. - a mature `C++20 `__ compiler, e.g., GCC 12+, Clang 14, NVCC 12.4, MSVC 19.39 or newer -- `CMake 3.24.0+ `__ +- `CMake 3.25.0+ `__ - `Git 2.18+ `__ - `AMReX `__: we automatically download and compile a copy - `pybind11 3.0.0+ `__: we automatically download and compile a copy diff --git a/pyproject.toml b/pyproject.toml index 661bfe92..0477e2f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = [ "setuptools>=42", "wheel", - "cmake>=3.24.0", + "cmake>=3.25.0", "packaging>=23", ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index f3d9b0f8..cf573ea3 100644 --- a/setup.py +++ b/setup.py @@ -63,14 +63,14 @@ def run(self): out = subprocess.check_output(["cmake", "--version"]) except OSError: raise RuntimeError( - "CMake 3.24.0+ must be installed to build the following " + "CMake 3.25.0+ must be installed to build the following " + "extensions: " + ", ".join(e.name for e in self.extensions) ) cmake_version = parse(re.search(r"version\s*([\d.]+)", out.decode()).group(1)) - if cmake_version < parse("3.24.0"): - raise RuntimeError("CMake >= 3.24.0 is required") + if cmake_version < parse("3.25.0"): + raise RuntimeError("CMake >= 3.25.0 is required") for ext in self.extensions: self.build_extension(ext)