|
chombo-discharge
|
Declaration of a namespace for SIMD-decorated loops over SoA particles. More...
#include <cstddef>#include <CD_Decorations.H>#include <CD_ParticleSoA.H>#include <CD_NamespaceHeader.H>#include <CD_NamespaceFooter.H>

Go to the source code of this file.
Namespaces | |
| namespace | ParticleLoops |
| Namespace for SIMD-decorated loops over SoA particles (particle analogue of BoxLoops). | |
Functions | |
| template<typename P , typename Traits , typename Functor > | |
| ALWAYS_INLINE void | ParticleLoops::loop (const ParticleSoA< P, Traits > &a_soa, Functor &&a_kernel) |
| Launch a kernel over every particle in a ParticleSoA, decorating the loop with CD_PRAGMA_SIMD. | |
| template<typename P , typename Traits , typename T , typename Functor > | |
| ALWAYS_INLINE T | ParticleLoops::reduce (const ParticleSoA< P, Traits > &a_soa, T a_initial, Functor &&a_kernel) |
| Fold a kernel over every particle in a ParticleSoA, accumulating a reduction value. | |
Declaration of a namespace for SIMD-decorated loops over SoA particles.
ParticleLoops is the particle analogue of BoxLoops: it provides loop overloads that iterate over the particles of a ParticleSoA and decorate the inner loop with CD_PRAGMA_SIMD, so elementwise per-particle kernels (hopefully) auto-vectorize. This mirrors BoxLoops exactly, with the cell index replaced by the particle index:
CD_PRAGMA_SIMD (GCC ivdep / clang vectorize(enable)) tells the compiler to ignore assumed loop-carried/aliasing dependencies, so the kernel vectorizes without the caller having to launder column pointers through __restrict, and without the compiler emitting runtime aliasing checks ("loop versioning"). ALWAYS_INLINE guarantees the kernel is inlined into the loop body.
(std::size_t i). Capture the column references/pointers ONCE before the loop (as above) – do not call soa.column<>() inside the kernel.ivdep does not guarantee a correct/vectorized reduction; use the reduce() overload, which folds the accumulator sequentially (no SIMD pragma) and is correct for sums/min/max.