Skip to content

Commit

Permalink
use AMREX_GPU_DEVICE
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Sep 17, 2023
1 parent 2a7e645 commit db02a5b
Show file tree
Hide file tree
Showing 40 changed files with 183 additions and 183 deletions.
38 changes: 19 additions & 19 deletions Source/driver/Castro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ Castro::initData ()
const Box& box_x = mfi.nodaltilebox(0);

amrex::ParallelFor(box_x,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
// C++ MHD problem initialization; has no effect if not
// implemented by a problem setup (defaults to an empty
Expand All @@ -1072,7 +1072,7 @@ Castro::initData ()
const Box& box_y = mfi.nodaltilebox(1);

amrex::ParallelFor(box_y,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
// C++ MHD problem initialization; has no effect if not
// implemented by a problem setup (defaults to an empty
Expand All @@ -1083,7 +1083,7 @@ Castro::initData ()
const Box& box_z = mfi.nodaltilebox(2);

amrex::ParallelFor(box_z,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
// C++ MHD problem initialization; has no effect if not
// implemented by a problem setup (defaults to an empty
Expand All @@ -1106,7 +1106,7 @@ Castro::initData ()
auto geomdata = geom.data();

amrex::ParallelFor(box,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
// problem initialization
problem_initialize_state_data(i, j, k, s, geomdata);
Expand Down Expand Up @@ -1149,7 +1149,7 @@ Castro::initData ()
Real lsmall_dens = small_dens;

reduce_op.eval(bx, reduce_data,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) -> ReduceTuple
[=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
{
// if the problem tried to initialize a thermodynamic
// state that is at or below small_temp, then we abort.
Expand Down Expand Up @@ -1199,7 +1199,7 @@ Castro::initData ()
auto S_arr = S_new.array(mfi);

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Real spec_sum = 0.0_rt;
for (int n = 0; n < NumSpec; n++) {
Expand Down Expand Up @@ -1287,7 +1287,7 @@ Castro::initData ()
auto S_arr = Sborder.array(mfi);

amrex::ParallelFor(box,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{

Real rhoInv = 1.0_rt / S_arr(i,j,k,URHO);
Expand Down Expand Up @@ -1384,7 +1384,7 @@ Castro::initData ()
#endif

amrex::ParallelFor(box,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
// C++ problem initialization; has no effect if not implemented
// by a problem setup (defaults to an empty routine).
Expand Down Expand Up @@ -3116,7 +3116,7 @@ Castro::normalize_species (MultiFab& S_new, int ng)
// then normalize them so that they sum to 1.

reduce_op.eval(bx, reduce_data,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) -> ReduceTuple
[=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
{
Real rhoX_sum = 0.0_rt;
Real rhoInv = 1.0_rt / u(i,j,k,URHO);
Expand Down Expand Up @@ -3193,7 +3193,7 @@ Castro::enforce_consistent_e (
#endif

ParallelFor(box,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Real rhoInv = 1.0_rt / S_arr(i,j,k,URHO);
Real u = S_arr(i,j,k,UMX) * rhoInv;
Expand Down Expand Up @@ -3369,7 +3369,7 @@ Castro::enforce_speed_limit (MultiFab& state_in, int ng)
auto u = state_in[mfi].array();

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Real rho = u(i,j,k,URHO);
Real rhoInv = 1.0_rt / rho;
Expand Down Expand Up @@ -3504,7 +3504,7 @@ Castro::apply_problem_tags (TagBoxArray& tags, Real time)
const GeometryData& geomdata = geom.data();

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
problem_tagging(i, j, k, tag_arr, state_arr, lev, geomdata);
});
Expand Down Expand Up @@ -3563,7 +3563,7 @@ Castro::apply_tagging_restrictions(TagBoxArray& tags, [[maybe_unused]] Real time
auto tag = tags[mfi].array();

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
bool outer_boundary_test[3] = {false};

Expand Down Expand Up @@ -3607,7 +3607,7 @@ Castro::apply_tagging_restrictions(TagBoxArray& tags, [[maybe_unused]] Real time
auto tag = tags[mfi].array();

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
const Real* problo = geomdata.ProbLo();
const Real* probhi = geomdata.ProbHi();
Expand Down Expand Up @@ -3700,7 +3700,7 @@ Castro::reset_internal_energy(const Box& bx,
Real ldual_energy_eta2 = dual_energy_eta2;

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Real rhoInv = 1.0_rt / u(i,j,k,URHO);
Real Up = u(i,j,k,UMX) * rhoInv;
Expand Down Expand Up @@ -3827,7 +3827,7 @@ Castro::add_magnetic_e( MultiFab& Bx,


ParallelFor(box,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{

Real bx_cell_c = 0.5_rt * (Bx_arr(i,j,k) + Bx_arr(i+1,j,k));
Expand Down Expand Up @@ -3872,7 +3872,7 @@ Castro::check_div_B( MultiFab& Bx,
const auto dx = geom.CellSizeArray();

reduce_op.eval(box, reduce_data,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) -> ReduceTuple
[=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
{

Real divB = (Bx_arr(i+1,j,k) - Bx_arr(i,j,k))/dx[0] +
Expand Down Expand Up @@ -4019,7 +4019,7 @@ Castro::computeTemp(
Array4<Real> const u = u_fab.array();

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{

Real rhoInv = 1.0_rt / u(i,j,k,URHO);
Expand Down Expand Up @@ -4293,7 +4293,7 @@ Castro::define_new_center(MultiFab& S, Real time)
Real cen = data(mi[0], mi[1], mi[2]);

amrex::ParallelFor(box,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept {
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
data(i,j,k) -= cen;
});

Expand Down
2 changes: 1 addition & 1 deletion Source/driver/Castro_advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ Castro::initialize_advance(Real time, Real dt, int amr_iteration)
auto geomdata = geom.data();

amrex::ParallelFor(box,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
// redo the problem initialization. We want to preserve
// the current velocity though, so save that and then
Expand Down
2 changes: 1 addition & 1 deletion Source/driver/Castro_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ Castro::restart (Amr& papa,
auto geomdata = geom.data();

amrex::ParallelFor(bx,
[=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) noexcept
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
// C++ problem initialization; has no effect if not implemented
// by a problem setup (defaults to an empty routine).
Expand Down
Loading

0 comments on commit db02a5b

Please sign in to comment.