Skip to content

Commit

Permalink
Merge pull request seahorce-scidac#130 from WeiqunZhang/cmake_sycl
Browse files Browse the repository at this point in the history
ERF_ENABLE_SYCL -> REMORA_ENABLE_SYCL
  • Loading branch information
hklion authored Jan 12, 2024
2 parents 7ee2842 + 7be4306 commit 8c3c54b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMake/SetAmrexOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ if(REMORA_ENABLE_HIP)
set(AMReX_GPU_BACKEND HIP CACHE STRING "AMReX GPU type" FORCE)
endif()

if(ERF_ENABLE_SYCL)
if(REMORA_ENABLE_SYCL)
set(AMReX_GPU_BACKEND SYCL CACHE STRING "AMReX GPU type" FORCE)
endif()
8 changes: 5 additions & 3 deletions Exec/Advection/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ init_custom_prob(

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

ParallelFor(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
auto T0 = m_solverChoice.T0;
auto S0 = m_solverChoice.S0;
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
{
const auto prob_lo = geomdata.ProbLo();
const auto prob_hi = geomdata.ProbHi();
Expand All @@ -103,7 +105,7 @@ init_custom_prob(

state(i, j, k, Temp_comp) = 1.;

state(i,j,k,Temp_comp)=m_solverChoice.T0; //+8.0*std::exp(z/50.0_rt);
state(i,j,k,Temp_comp)=T0; //+8.0*std::exp(z/50.0_rt);

// Set scalar = 0 everywhere
const Real xcent = 0.5*(prob_lo[0] + prob_hi[0]);
Expand All @@ -116,7 +118,7 @@ init_custom_prob(
const Real radsq = rad*rad;

if (l_use_salt) {
state(i,j,k,Salt_comp)= m_solverChoice.S0;
state(i,j,k,Salt_comp)= S0;
}

state(i, j, k, Scalar_comp) = std::exp(-r2/(2.*radsq));
Expand Down
8 changes: 5 additions & 3 deletions Exec/DoublyPeriodic/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ init_custom_prob(

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

ParallelFor(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
auto T0 = m_solverChoice.T0;
auto S0 = m_solverChoice.S0;
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
{
const auto prob_lo = geomdata.ProbLo();
const auto prob_hi = geomdata.ProbHi();
Expand All @@ -139,9 +141,9 @@ init_custom_prob(

state(i, j, k, Temp_comp) = 1.;

state(i,j,k,Temp_comp)=m_solverChoice.T0+8.0*std::exp(z/50.0_rt);
state(i,j,k,Temp_comp)=T0+8.0*std::exp(z/50.0_rt);
if (l_use_salt) {
state(i,j,k,Salt_comp)=m_solverChoice.S0;
state(i,j,k,Salt_comp)=S0;
}

// Set scalar = 0 everywhere
Expand Down
8 changes: 5 additions & 3 deletions Exec/Seamount/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ init_custom_prob(

AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);

ParallelFor(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
auto T0 = m_solverChoice.T0;
auto S0 = m_solverChoice.S0;
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
{
// Geometry (note we must include these here to get the data on device)
// const auto prob_lo = geomdata.ProbLo();
Expand All @@ -112,9 +114,9 @@ init_custom_prob(

state(i, j, k, Temp_comp) = 1.;

state(i,j,k,Temp_comp)=m_solverChoice.T0+7.5_rt*std::exp(z/1000.0_rt);
state(i,j,k,Temp_comp)=T0+7.5_rt*std::exp(z/1000.0_rt);
if (l_use_salt) {
state(i,j,k,Salt_comp)=m_solverChoice.S0;
state(i,j,k,Salt_comp)=S0;
}

// Set scalar = 0 everywhere
Expand Down

0 comments on commit 8c3c54b

Please sign in to comment.