From 2021f2c22f98a65df12368af7981882a09ab6dd3 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 30 Jun 2025 12:08:01 -0400 Subject: [PATCH 01/12] update to C++20 --- Exec/Make.Castro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Exec/Make.Castro b/Exec/Make.Castro index 9f6990c173..dba0a4a890 100644 --- a/Exec/Make.Castro +++ b/Exec/Make.Castro @@ -52,8 +52,8 @@ ifeq ("$(wildcard $(AMREX_HOME)/Tools/GNUMake/Make.defs)","") $(error AMReX has not been downloaded. Please run "git submodule update --init" from the top level of the code) endif -# Require C++17 -CXXSTD := c++17 +# Require C++20 +CXXSTD := c++20 # Use Lazy QueueReduction for the timing outputs LAZY := TRUE From fdb646526552b31b6dab800c73518917a7f8ca13 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 30 Jun 2025 12:27:36 -0400 Subject: [PATCH 02/12] update ranges to C++20 --- Util/model_parser/model_parser.H | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Util/model_parser/model_parser.H b/Util/model_parser/model_parser.H index eef0a27736..9d243e4781 100644 --- a/Util/model_parser/model_parser.H +++ b/Util/model_parser/model_parser.H @@ -5,6 +5,8 @@ #include #include #include +#include + #include #include #include @@ -44,20 +46,16 @@ namespace model_string { inline std::string& ltrim(std::string& s) { - auto it = std::find_if(s.begin(), s.end(), - [](int c) { - return !std::isspace(c); - }); + auto it = std::ranges::find_if(s, + [] (int c) {return !std::isspace(c);}); s.erase(s.begin(), it); return s; } inline std::string& rtrim(std::string& s) { - auto it = std::find_if(s.rbegin(), s.rend(), - [](int c) { - return !std::isspace(c); - }); + auto it = std::ranges::find_if(std::ranges::reverse_view(s), + [] (int c) {return !std::isspace(c);}); s.erase(it.base(), s.end()); return s; } From 9a04896fa9bccdfd2af3f096a97dbadb947a7e66 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 30 Jun 2025 12:34:18 -0400 Subject: [PATCH 03/12] suppress a check --- .clang-tidy | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-tidy b/.clang-tidy index 8b39d79339..bbb53c808a 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -25,6 +25,7 @@ Checks: > -misc-redundant-expression, modernize-*, -modernize-avoid-c-arrays, + -modernize-use-designated-initializers, -modernize-use-trailing-return-type, performance-*, -performance-avoid-endl, From d892690d323cfa4d22e0d1eb18046cabce1160a9 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 30 Jun 2025 13:04:59 -0400 Subject: [PATCH 04/12] suppress a warning --- Source/gravity/Gravity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/gravity/Gravity.cpp b/Source/gravity/Gravity.cpp index 0bb900eedc..02dcfe14fa 100644 --- a/Source/gravity/Gravity.cpp +++ b/Source/gravity/Gravity.cpp @@ -1771,7 +1771,7 @@ Gravity::init_multipole_grav() const maxWidth = amrex::max(maxWidth, probhi[2] - problo[2]); } - multipole::rmax = 0.5_rt * maxWidth * std::sqrt(static_cast(AMREX_SPACEDIM)); + multipole::rmax = 0.5_rt * maxWidth * std::sqrt(static_cast(AMREX_SPACEDIM)); // NOLINT(modernize-use-std-numbers) } void From 72882f09bad9b99faca0d8f9b40c4b3a6224daca Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 30 Jun 2025 13:17:01 -0400 Subject: [PATCH 05/12] bump CUDA up to 12 for C++20 --- .github/workflows/gpu_action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gpu_action.yml b/.github/workflows/gpu_action.yml index be931d63bc..d5b2872fe4 100644 --- a/.github/workflows/gpu_action.yml +++ b/.github/workflows/gpu_action.yml @@ -29,7 +29,7 @@ jobs: sudo apt-get -qq -y install curl cmake jq clang g++>=9.3.0 - name: Install CUDA - run: .github/workflows/dependencies/dependencies_nvcc.sh 11.8 + run: .github/workflows/dependencies/dependencies_nvcc.sh 12.6 - name: Install hypre run: | From ad79afee0a1bea220c56633079c883f73a1df055 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 30 Jun 2025 13:27:55 -0400 Subject: [PATCH 06/12] bump up hypre --- .github/workflows/gpu_action.yml | 8 ++++---- Docs/source/getting_started.rst | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gpu_action.yml b/.github/workflows/gpu_action.yml index d5b2872fe4..2bd49e223c 100644 --- a/.github/workflows/gpu_action.yml +++ b/.github/workflows/gpu_action.yml @@ -33,10 +33,10 @@ jobs: - name: Install hypre run: | - wget -q https://github.com/hypre-space/hypre/archive/refs/tags/v2.28.0.tar.gz - tar xfz v2.28.0.tar.gz - cd hypre-2.28.0/src - CUDA_HOME=/usr/local/cuda HYPRE_CUDA_SM=60 ./configure --with-cxxstandard=17 --with-cuda --enable-unified-memory --without-MPI + wget -q https://github.com/hypre-space/hypre/archive/refs/tags/v2.33.0.tar.gz + tar xfz v2.33.0.tar.gz + cd hypre-2.33.0/src + CUDA_HOME=/usr/local/cuda HYPRE_CUDA_SM=60 ./configure --with-cxxstandard=20 --with-cuda --enable-unified-memory --without-MPI make -j 4 make install cd ../../ diff --git a/Docs/source/getting_started.rst b/Docs/source/getting_started.rst index 0952bbbb53..adfa261573 100644 --- a/Docs/source/getting_started.rst +++ b/Docs/source/getting_started.rst @@ -14,7 +14,7 @@ Getting Started The compilation process is managed by AMReX and its build system. The general requirements to build Castro are: - * A C++17 (or later) compiler (for GCC, we need >= 9.0 for CUDA compilation) + * A C++20 (or later) compiler (for GCC, we need >= 13.1) * python (>= 3.10) @@ -24,7 +24,7 @@ GCC is the main compiler suite used by the developers. For running in parallel, an MPI library is required. For running on GPUs: -* CUDA 11 or later is required for NVIDIA GPUs +* CUDA 12 or later is required for NVIDIA GPUs * ROCM 6.3.1 or later is required for AMD GPUs (earlier versions have a register allocation bug) From c36b33989e3dfc3dd02302ffa83546496db6e039 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Wed, 29 Oct 2025 10:57:42 -0400 Subject: [PATCH 07/12] some sprinf --- Source/driver/main.cpp | 10 ++-------- Source/radiation/Radiation.cpp | 14 +++++--------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Source/driver/main.cpp b/Source/driver/main.cpp index 9e7665234e..6c7e73aa9b 100644 --- a/Source/driver/main.cpp +++ b/Source/driver/main.cpp @@ -255,14 +255,8 @@ main (int argc, // // It's actually the high water mark of heap space required by FABs. // - char buf[256]; - - sprintf(buf, - "CPU(%d): Heap Space (bytes) used by Coalescing FAB Arena: %ld", - ParallelDescriptor::MyProc(), - arena->heap_space_used()); - - std::cout << buf << std::endl; + std::cout << std::format("CPU({}): Heap Space (bytes) used by Coalescing FAB Arena: {}\n", + ParallelDescriptor::MyProc(), arena->heap_space_used()); } BL_PROFILE_VAR_STOP(pmain); diff --git a/Source/radiation/Radiation.cpp b/Source/radiation/Radiation.cpp index 277c95db63..8f661befa5 100644 --- a/Source/radiation/Radiation.cpp +++ b/Source/radiation/Radiation.cpp @@ -647,27 +647,23 @@ void Radiation::checkPoint(int level, // if (ParallelDescriptor::IOProcessor()) { int oldprec = os.precision(20); - sprintf(buf, "delta_e_rat_level[%d]= ", level); - std::string DeltaString = buf; + auto DeltaString = std::format("delta_e_rat_level[{}]= ", level); os << DeltaString << delta_e_rat_level[level] << '\n'; - sprintf(buf, "delta_T_rat_level[%d]= ", level); - DeltaString = buf; + DeltaString = std::format("delta_T_rat_level[{}]= ", level); os << DeltaString << delta_T_rat_level[level] << '\n'; os.precision(oldprec); } // Path name construction stolen from AmrLevel::checkPoint - sprintf(buf, "Level_%d", level); - std::string Level = buf; + std::string Level = std::format("Level_{}", level); // // Write name of conservation flux register to header. // - sprintf(buf, "/RadFlux"); std::string PathNameInHeader = Level; - PathNameInHeader += buf; + PathNameInHeader += "/RadFlux"; if (ParallelDescriptor::IOProcessor()) { os << PathNameInHeader; } @@ -691,7 +687,7 @@ void Radiation::checkPoint(int level, FullPathName += '/'; } FullPathName += Level; - FullPathName += buf; + FullPathName += "/RadFlux"; // // Output conservation flux register. // From 7d73fea9547aac76767f06c514026880c60e3e9b Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Wed, 29 Oct 2025 11:45:44 -0400 Subject: [PATCH 08/12] fix hypre loc --- .github/workflows/gpu_action.yml | 2 +- Source/radiation/Radiation.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/gpu_action.yml b/.github/workflows/gpu_action.yml index 47b276c74b..18f8650a15 100644 --- a/.github/workflows/gpu_action.yml +++ b/.github/workflows/gpu_action.yml @@ -56,5 +56,5 @@ jobs: - name: Compile problems for GPU run: | export PATH=$PATH:/usr/local/cuda/bin - export AMREX_HYPRE_HOME=${PWD}/hypre-2.28.0/src/hypre + export AMREX_HYPRE_HOME=${PWD}/hypre-2.33.0/src/hypre python3 external/cpp-linter-action/run_on_changed_files.py ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -header-filter=Castro -ignore-files="amrex|Microphysics" -gpu diff --git a/Source/radiation/Radiation.cpp b/Source/radiation/Radiation.cpp index 8f661befa5..79e297ddc1 100644 --- a/Source/radiation/Radiation.cpp +++ b/Source/radiation/Radiation.cpp @@ -13,8 +13,6 @@ #include #endif -#include - using namespace amrex; Radiation::Solver_Type Radiation::SolverType = Radiation::InvalidSolver; From 4b5851c19f8041b09a7556acbfe120cac85ab8c8 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Wed, 29 Oct 2025 14:30:51 -0400 Subject: [PATCH 09/12] update format --- Source/driver/main.cpp | 1 + Source/radiation/Radiation.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Source/driver/main.cpp b/Source/driver/main.cpp index 6c7e73aa9b..f7c0df3fb3 100644 --- a/Source/driver/main.cpp +++ b/Source/driver/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/Source/radiation/Radiation.cpp b/Source/radiation/Radiation.cpp index 8f661befa5..7f0b584cdd 100644 --- a/Source/radiation/Radiation.cpp +++ b/Source/radiation/Radiation.cpp @@ -7,6 +7,7 @@ #include +#include #include #ifdef _OPENMP From 2f667ad4ac0003451b39822cfb298db26d572492 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 3 Nov 2025 19:49:02 -0500 Subject: [PATCH 10/12] try getting cuda comopile --- .github/workflows/gpu_action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gpu_action.yml b/.github/workflows/gpu_action.yml index 18f8650a15..65377de019 100644 --- a/.github/workflows/gpu_action.yml +++ b/.github/workflows/gpu_action.yml @@ -8,7 +8,7 @@ concurrency: jobs: gpu-compilation: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 with: @@ -29,7 +29,7 @@ jobs: sudo apt-get -qq -y install curl cmake jq clang g++>=9.3.0 - name: Install CUDA - run: .github/workflows/dependencies/dependencies_nvcc.sh 12.6 + run: .github/workflows/dependencies/dependencies_nvcc.sh 12.9 - name: Install hypre run: | From 38179fa0fd9278a49d15b1b82785b900ab7efba3 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Tue, 4 Nov 2025 20:33:41 -0500 Subject: [PATCH 11/12] update CUDA --- .github/workflows/dependencies/dependencies_nvcc.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependencies/dependencies_nvcc.sh b/.github/workflows/dependencies/dependencies_nvcc.sh index 8f6ac3ead4..839bffa1ac 100755 --- a/.github/workflows/dependencies/dependencies_nvcc.sh +++ b/.github/workflows/dependencies/dependencies_nvcc.sh @@ -25,8 +25,8 @@ sudo apt-get install -y \ wget VERSION_DOTTED=${1-12.0} && VERSION_DASHED=$(sed 's/\./-/' <<< $VERSION_DOTTED) -curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb -sudo dpkg -i cuda-keyring_1.0-1_all.deb +curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb +sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update sudo apt-get install -y \ cuda-command-line-tools-$VERSION_DASHED \ @@ -35,8 +35,10 @@ sudo apt-get install -y \ cuda-minimal-build-$VERSION_DASHED \ cuda-nvml-dev-$VERSION_DASHED \ cuda-nvtx-$VERSION_DASHED \ - libcublas-dev-$VERSION_DASHED \ libcufft-dev-$VERSION_DASHED \ libcurand-dev-$VERSION_DASHED \ libcusparse-dev-$VERSION_DASHED + +sudo apt-get install -y --no-install-recommends libnvjitlink-dev-$VERSION_DASHED || true + sudo ln -s cuda-$VERSION_DOTTED /usr/local/cuda From 6dd8b8a81995f75668f77c2c17f0cbdc82e72e60 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Tue, 4 Nov 2025 20:45:56 -0500 Subject: [PATCH 12/12] add cublas --- .github/workflows/dependencies/dependencies_nvcc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dependencies/dependencies_nvcc.sh b/.github/workflows/dependencies/dependencies_nvcc.sh index 839bffa1ac..cd321bd66c 100755 --- a/.github/workflows/dependencies/dependencies_nvcc.sh +++ b/.github/workflows/dependencies/dependencies_nvcc.sh @@ -35,6 +35,7 @@ sudo apt-get install -y \ cuda-minimal-build-$VERSION_DASHED \ cuda-nvml-dev-$VERSION_DASHED \ cuda-nvtx-$VERSION_DASHED \ + libcublas-dev-$VERSION_DASHED \ libcufft-dev-$VERSION_DASHED \ libcurand-dev-$VERSION_DASHED \ libcusparse-dev-$VERSION_DASHED