Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMREX_USE_CUDA -> AMREX_USE_GPU #424

Merged
merged 2 commits into from
Mar 26, 2024
Merged
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
6 changes: 3 additions & 3 deletions Source/Maestro.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ using namespace maestro;
#include <PhysBCFunctMaestro.H>
#include <SimpleLog.H>

/// Define Real vector types for CUDA-compatability. If `AMREX_USE_CUDA`, then
/// this will be stored in CUDA managed memory.
#ifdef AMREX_USE_CUDA
/// Define Real vector types for GPU-compatability. If `AMREX_USE_GPU`, then
/// this will be stored in GPU managed memory.
#ifdef AMREX_USE_GPU
using RealVector = amrex::Gpu::ManagedVector<amrex::Real>;
using IntVector = amrex::Gpu::ManagedVector<int>;
#else
Expand Down
8 changes: 4 additions & 4 deletions Source/MaestroAverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void Maestro::Average(const Vector<MultiFab>& phi, BaseState<Real>& phibar,

const Array4<const Real> phi_arr = phi[lev].array(mfi, comp);

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
// Atomic::Add is non-deterministic on the GPU. If this flag is true,
// run on the CPU instead
bool launched;
Expand All @@ -70,7 +70,7 @@ void Maestro::Average(const Vector<MultiFab>& phi, BaseState<Real>& phibar,
phi_arr(i, j, k));
});

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
if (deterministic_nodal_solve) {
// turn GPU back on
if (launched) Gpu::setLaunchRegion(true);
Expand Down Expand Up @@ -231,7 +231,7 @@ void Maestro::Average(const Vector<MultiFab>& phi, BaseState<Real>& phibar,

bool use_mask = !(lev == fine_lev - 1);

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
// Atomic::Add is non-deterministic on the GPU. If this flag is true,
// run on the CPU instead
bool launched;
Expand Down Expand Up @@ -280,7 +280,7 @@ void Maestro::Average(const Vector<MultiFab>& phi, BaseState<Real>& phibar,
}
});

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
if (deterministic_nodal_solve) {
// turn GPU back on
if (launched) Gpu::setLaunchRegion(true);
Expand Down
2 changes: 1 addition & 1 deletion Source/MaestroDt.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#include <Maestro.H>

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
#include <AMReX_Arena.H>
#include <cuda_runtime_api.h>
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/MaestroFill3dData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ void Maestro::Addw0(Vector<std::array<MultiFab, AMREX_SPACEDIM> >& u_edge,
}

if (finest_level == 0) {
#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
// FillBoundary can be non-deterministic on the GPU for non-cell
// centered data (like u_edge here). If this flag is true, run
// on the CPU instead
Expand All @@ -441,7 +441,7 @@ void Maestro::Addw0(Vector<std::array<MultiFab, AMREX_SPACEDIM> >& u_edge,
}
}

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
if (deterministic_nodal_solve) {
// turn GPU back on
if (launched) Gpu::setLaunchRegion(true);
Expand Down
4 changes: 2 additions & 2 deletions Source/MaestroMakeEta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void Maestro::MakeEtarho(const Vector<MultiFab>& etarho_flux) {
// timer for profiling
BL_PROFILE_VAR("Maestro::MakeEtarho()", MakeEtarho);

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
bool launched;
if (deterministic_nodal_solve) {
launched = !Gpu::notInLaunchRegion();
Expand Down Expand Up @@ -161,7 +161,7 @@ void Maestro::MakeEtarho(const Vector<MultiFab>& etarho_flux) {
RestrictBase(etarho_cc, true);
FillGhostBase(etarho_cc, true);

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
if (deterministic_nodal_solve) {
// turn GPU back on
if (launched) Gpu::setLaunchRegion(true);
Expand Down
8 changes: 4 additions & 4 deletions Source/MaestroNodalProj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void Maestro::NodalProj(int proj_type, Vector<MultiFab>& rhcc,
rhcc[lev].mult(-1.0, 0, 1, 1);
}

#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
// compRHS is non-deterministic on the GPU. If this flag is true, run
// on the CPU instead
bool launched;
Expand All @@ -228,7 +228,7 @@ void Maestro::NodalProj(int proj_type, Vector<MultiFab>& rhcc,
mlndlap.compRHS(amrex::GetVecOfPtrs(rhstotal), amrex::GetVecOfPtrs(Vproj),
{}, // pass in null rhnd
amrex::GetVecOfPtrs(rhcc));
#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
if (deterministic_nodal_solve) {
// turn GPU back on
if (launched) Gpu::setLaunchRegion(true);
Expand Down Expand Up @@ -288,7 +288,7 @@ void Maestro::NodalProj(int proj_type, Vector<MultiFab>& rhcc,

// solve for phi
Print() << "Calling nodal solver" << std::endl;
#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
if (deterministic_nodal_solve) {
launched = !Gpu::notInLaunchRegion();
// turn off GPU
Expand All @@ -297,7 +297,7 @@ void Maestro::NodalProj(int proj_type, Vector<MultiFab>& rhcc,
#endif
mlmg.solve(amrex::GetVecOfPtrs(phi), amrex::GetVecOfConstPtrs(rhstotal),
rel_tol, abs_tol);
#ifdef AMREX_USE_CUDA
#ifdef AMREX_USE_GPU
if (deterministic_nodal_solve) {
// turn GPU back on
if (launched) Gpu::setLaunchRegion(true);
Expand Down