Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/dependencies/dependencies_nvcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
14 changes: 7 additions & 7 deletions .github/workflows/gpu_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:

jobs:
gpu-compilation:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
Expand All @@ -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 ../../
Expand All @@ -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
4 changes: 2 additions & 2 deletions Docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions Exec/Make.Castro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 3 additions & 8 deletions Source/driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <new>
#include <cstdio>
#include <cstring>
#include <format>
#include <iostream>
#include <iomanip>

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/gravity/Gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Real>(AMREX_SPACEDIM));
multipole::rmax = 0.5_rt * maxWidth * std::sqrt(static_cast<Real>(AMREX_SPACEDIM)); // NOLINT(modernize-use-std-numbers)
}

void
Expand Down
17 changes: 6 additions & 11 deletions Source/radiation/Radiation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

#include <opacity.H>

#include <format>
#include <iostream>

#ifdef _OPENMP
#include <omp.h>
#endif

#include <sstream>

using namespace amrex;

Radiation::Solver_Type Radiation::SolverType = Radiation::InvalidSolver;
Expand Down Expand Up @@ -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;
}
Expand All @@ -691,7 +686,7 @@ void Radiation::checkPoint(int level,
FullPathName += '/';
}
FullPathName += Level;
FullPathName += buf;
FullPathName += "/RadFlux";
//
// Output conservation flux register.
//
Expand Down
14 changes: 6 additions & 8 deletions Util/model_parser/model_parser.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <fstream>
#include <vector>
#include <algorithm>
#include <ranges>

#include <network.H>
#include <model_parser_data.H>
#include <AMReX_Print.H>
Expand Down Expand Up @@ -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;
}
Expand Down