From 1f1cd934e82e4cffa9c68ab35c802e6298ac6501 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 11 Jun 2021 16:27:24 -0700 Subject: Fix Offset: PushPX -> evolve_opt (#2011) * Fix Offset: PushPX -> evolve_opt Comparing to the `doParticlePush()` above, the `ux`/`uy`/`uz` SoA attributes seem to lack the particle offset in `PushPX`. Also simplifies the offset calculation to reside off-kernel, which saves 8 bytes cmem and some index indirection logic for the compiler. * RigidInjected Particle: Fix Offset Looks like this is missing here, too? --- .../Particles/RigidInjectedParticleContainer.cpp | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Source/Particles/RigidInjectedParticleContainer.cpp') diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp index 5cb49f69c..15d11d0e0 100644 --- a/Source/Particles/RigidInjectedParticleContainer.cpp +++ b/Source/Particles/RigidInjectedParticleContainer.cpp @@ -254,9 +254,9 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti, const auto GetPosition = GetParticlePosition(pti); auto SetPosition = SetParticlePosition(pti); - ParticleReal* const AMREX_RESTRICT ux = uxp.dataPtr(); - ParticleReal* const AMREX_RESTRICT uy = uyp.dataPtr(); - ParticleReal* const AMREX_RESTRICT uz = uzp.dataPtr(); + ParticleReal* const AMREX_RESTRICT ux = uxp.dataPtr() + offset; + ParticleReal* const AMREX_RESTRICT uy = uyp.dataPtr() + offset; + ParticleReal* const AMREX_RESTRICT uz = uzp.dataPtr() + offset; if (!done_injecting_lev) { @@ -271,13 +271,13 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti, uyp_save.resize(np); uzp_save.resize(np); - amrex::Real* const AMREX_RESTRICT xp_save_ptr = xp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT yp_save_ptr = yp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT zp_save_ptr = zp_save.dataPtr(); + amrex::Real* const AMREX_RESTRICT xp_save_ptr = xp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT yp_save_ptr = yp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT zp_save_ptr = zp_save.dataPtr() + offset; - amrex::Real* const AMREX_RESTRICT uxp_save_ptr = uxp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT uyp_save_ptr = uyp_save.dataPtr(); - amrex::Real* const AMREX_RESTRICT uzp_save_ptr = uzp_save.dataPtr(); + amrex::Real* const AMREX_RESTRICT uxp_save_ptr = uxp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT uyp_save_ptr = uyp_save.dataPtr() + offset; + amrex::Real* const AMREX_RESTRICT uzp_save_ptr = uzp_save.dataPtr() + offset; amrex::ParallelFor( np, [=] AMREX_GPU_DEVICE (long i) { @@ -302,12 +302,12 @@ RigidInjectedParticleContainer::PushPX (WarpXParIter& pti, if (!done_injecting_lev) { - ParticleReal* AMREX_RESTRICT x_save = xp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT y_save = yp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT z_save = zp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT ux_save = uxp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT uy_save = uyp_save.dataPtr(); - ParticleReal* AMREX_RESTRICT uz_save = uzp_save.dataPtr(); + ParticleReal* AMREX_RESTRICT x_save = xp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT y_save = yp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT z_save = zp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT ux_save = uxp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT uy_save = uyp_save.dataPtr() + offset; + ParticleReal* AMREX_RESTRICT uz_save = uzp_save.dataPtr() + offset; // Undo the push for particles not injected yet. // The zp are advanced a fixed amount. -- cgit v1.2.3