diff --git a/.clang-tidy b/.clang-tidy index 747eb0e398..82629bf83e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -26,6 +26,7 @@ Checks: > -misc-redundant-expression, modernize-*, -modernize-avoid-c-arrays, + -modernize-use-designated-initializers, -modernize-use-trailing-return-type, performance-*, -performance-avoid-endl, diff --git a/.github/workflows/dependencies/dependencies_nvcc.sh b/.github/workflows/dependencies/dependencies_nvcc.sh index 8f6ac3ead4..cd321bd66c 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 \ @@ -39,4 +39,7 @@ sudo apt-get install -y \ 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 diff --git a/.github/workflows/gpu_action.yml b/.github/workflows/gpu_action.yml index 2ff0da8e8c..8e4aa193be 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@v6 with: @@ -29,14 +29,14 @@ 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.9 - 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 ../../ @@ -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/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) 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 diff --git a/Source/driver/main.cpp b/Source/driver/main.cpp index 9e7665234e..f7c0df3fb3 100644 --- a/Source/driver/main.cpp +++ b/Source/driver/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -255,14 +256,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/gravity/Gravity.cpp b/Source/gravity/Gravity.cpp index e91174531c..6a7bbdc28e 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 diff --git a/Source/radiation/Radiation.cpp b/Source/radiation/Radiation.cpp index 277c95db63..c0af1dc879 100644 --- a/Source/radiation/Radiation.cpp +++ b/Source/radiation/Radiation.cpp @@ -7,14 +7,13 @@ #include +#include #include #ifdef _OPENMP #include #endif -#include - using namespace amrex; Radiation::Solver_Type Radiation::SolverType = Radiation::InvalidSolver; @@ -647,27 +646,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 +686,7 @@ void Radiation::checkPoint(int level, FullPathName += '/'; } FullPathName += Level; - FullPathName += buf; + FullPathName += "/RadFlux"; // // Output conservation flux register. // diff --git a/Util/model_parser/model_parser.H b/Util/model_parser/model_parser.H index b96e4fd86f..76cda59dc1 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 @@ -60,20 +62,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; }