From e3c3b32a751575d2e8ada7087119b034f6b77623 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Wed, 10 Jan 2024 14:21:31 -0800 Subject: [PATCH 1/2] ERF_ENABLE_SYCL -> REMORA_ENABLE_SYCL --- CMake/SetAmrexOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/SetAmrexOptions.cmake b/CMake/SetAmrexOptions.cmake index 10725ebc..0f133e72 100644 --- a/CMake/SetAmrexOptions.cmake +++ b/CMake/SetAmrexOptions.cmake @@ -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() From 7be4306c4ade32c4911611a611241c734cb3e606 Mon Sep 17 00:00:00 2001 From: Weiqun Zhang Date: Wed, 10 Jan 2024 23:32:40 +0000 Subject: [PATCH 2/2] Fix some device copyable issues --- Exec/Advection/prob.cpp | 8 +++++--- Exec/DoublyPeriodic/prob.cpp | 8 +++++--- Exec/Seamount/prob.cpp | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Exec/Advection/prob.cpp b/Exec/Advection/prob.cpp index 5ee8961c..30d4848b 100644 --- a/Exec/Advection/prob.cpp +++ b/Exec/Advection/prob.cpp @@ -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(); @@ -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]); @@ -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)); diff --git a/Exec/DoublyPeriodic/prob.cpp b/Exec/DoublyPeriodic/prob.cpp index d55fafc8..2cc31eff 100644 --- a/Exec/DoublyPeriodic/prob.cpp +++ b/Exec/DoublyPeriodic/prob.cpp @@ -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(); @@ -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 diff --git a/Exec/Seamount/prob.cpp b/Exec/Seamount/prob.cpp index 0dd18ab9..863a7603 100644 --- a/Exec/Seamount/prob.cpp +++ b/Exec/Seamount/prob.cpp @@ -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(); @@ -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