aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/RigidInjectedParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Weiqun Zhang <WeiqunZhang@lbl.gov> 2023-02-21 09:03:05 -0800
committerGravatar GitHub <noreply@github.com> 2023-02-21 09:03:05 -0800
commit892958903f96367df47242b4f6c63b20fa11221e (patch)
tree910dfed0aabe391f8e6478c389d4d488769f726b /Source/Particles/RigidInjectedParticleContainer.cpp
parent94d292627bb49c17a4b6e17e54232a56cec8955a (diff)
downloadWarpX-892958903f96367df47242b4f6c63b20fa11221e.tar.gz
WarpX-892958903f96367df47242b4f6c63b20fa11221e.tar.zst
WarpX-892958903f96367df47242b4f6c63b20fa11221e.zip
GetExternalEBField: Use AMReX's CompileTimeOption ParallelFor (#3696)
This greatly improves the performance on AMD and Intel GPUs when GetExternalEBField is not used.
Diffstat (limited to 'Source/Particles/RigidInjectedParticleContainer.cpp')
-rw-r--r--Source/Particles/RigidInjectedParticleContainer.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp
index cc064538b..493b14e55 100644
--- a/Source/Particles/RigidInjectedParticleContainer.cpp
+++ b/Source/Particles/RigidInjectedParticleContainer.cpp
@@ -407,7 +407,14 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt,
const auto pusher_algo = WarpX::particle_pusher_algo;
const auto do_crr = do_classical_radiation_reaction;
- amrex::ParallelFor( np, [=] AMREX_GPU_DEVICE (long ip)
+ enum exteb_flags : int { no_exteb, has_exteb };
+
+ int exteb_runtime_flag = getExternalEB.isNoOp() ? no_exteb : has_exteb;
+
+ amrex::ParallelFor(TypeList<CompileTimeOptions<no_exteb,has_exteb>>{},
+ {exteb_runtime_flag},
+ np, [=,getExternalEB=getExternalEB]
+ AMREX_GPU_DEVICE (long ip, auto exteb_control)
{
ux_save[ip] = uxpp[ip];
uy_save[ip] = uypp[ip];
@@ -425,7 +432,10 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt,
ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes,
nox, galerkin_interpolation);
- getExternalEB(ip, Exp, Eyp, Ezp, Bxp, Byp, Bzp);
+
+ if constexpr (exteb_control == has_exteb) {
+ getExternalEB(ip, Exp, Eyp, Ezp, Bxp, Byp, Bzp);
+ }
amrex::ParticleReal qp = q;
if (ion_lev) { qp *= ion_lev[ip]; }