Skip to content

Commit

Permalink
fix compile issue with SYCL compilers (erf-model#1369)
Browse files Browse the repository at this point in the history
* use primitives instead of struct inside amrex::ParallelFor loop

fixes compile issue with SYCL compilers (Intel GPUs)

* fix whitespace
  • Loading branch information
michaelbuehlmann authored Jan 9, 2024
1 parent 1b743c7 commit 5786ab5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Source/TimeIntegration/ERF_make_buoyancy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ void make_buoyancy (Vector<MultiFab>& S_data,
// TODO: A microphysics model may have more than q1 & q2 components for the
// non-precipitating phase.

amrex::ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k)
amrex::ParallelFor(tbz, [=, moisture_type=solverChoice.moisture_type] AMREX_GPU_DEVICE (int i, int j, int k)
{
Real rhop_lo, rhop_hi;
if(solverChoice.moisture_type == MoistureType::FastEddy){
if(moisture_type == MoistureType::FastEddy){
rhop_hi = cell_data(i,j,k ,Rho_comp) + cell_data(i,j,k ,RhoQ1_comp) + cell_data(i,j,k ,RhoQ2_comp) - r0_arr(i,j,k );
rhop_lo = cell_data(i,j,k-1,Rho_comp) + cell_data(i,j,k-1,RhoQ1_comp) + cell_data(i,j,k-1,RhoQ2_comp) - r0_arr(i,j,k-1);
}else{
Expand Down Expand Up @@ -234,7 +234,7 @@ void make_buoyancy (Vector<MultiFab>& S_data,
const Array4<const Real> & cell_prim = S_prim.array(mfi);

// TODO: ice has not been dealt with (q1=qv, q2=qv, q3=qp)
amrex::ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k)
amrex::ParallelFor(tbz, [=, buoyancy_type=solverChoice.buoyancy_type] AMREX_GPU_DEVICE (int i, int j, int k)
{
Real tempp1d = getTgivenRandRTh(rho_d_ptr[k ], rho_d_ptr[k ]*theta_d_ptr[k ]);
Real tempm1d = getTgivenRandRTh(rho_d_ptr[k-1], rho_d_ptr[k-1]*theta_d_ptr[k-1]);
Expand All @@ -253,7 +253,7 @@ void make_buoyancy (Vector<MultiFab>& S_data,
Real qp_plus = (n_moist_var >= 3) ? cell_prim(i,j,k ,PrimQ3_comp) : 0.0;
Real qp_minus = (n_moist_var >= 3) ? cell_prim(i,j,k-1,PrimQ3_comp) : 0.0;

if (solverChoice.buoyancy_type == 2) {
if (buoyancy_type == 2) {
qplus = 0.61 * ( qv_plus - qv_d_ptr[k] ) -
( qc_plus - qc_d_ptr[k] +
qp_plus - qp_d_ptr[k] )
Expand All @@ -264,7 +264,7 @@ void make_buoyancy (Vector<MultiFab>& S_data,
qp_minus - qp_d_ptr[k-1] )
+ (tempm3d-tempm1d)/tempm1d*(Real(1.0) + Real(0.61)*qv_d_ptr[k-1]-qc_d_ptr[k-1]-qp_d_ptr[k-1]);

} else if (solverChoice.buoyancy_type == 4) {
} else if (buoyancy_type == 4) {
qplus = 0.61 * ( qv_plus - qv_d_ptr[k] ) -
( qc_plus - qc_d_ptr[k] +
qp_plus - qp_d_ptr[k] )
Expand Down

0 comments on commit 5786ab5

Please sign in to comment.