raja performance portability
**RAJA Performance Portability: LLNL's Loop Abstraction — separating algorithm specification from execution policy**
RAJA is LLNL's C++ performance portability framework emphasizing explicit loop structure and backend-agnostic execution policies. Unlike Kokkos' view abstraction, RAJA focuses on kernel specification via forall and kernel constructs.
**RAJA Execution Policies**
forall(RangeSegment(0, N), policy, [](int i) { ... }) encapsulates parallelism. Policies include: cuda_exec (GPU blocks/threads), omp_parallel_for_exec (OpenMP parallel), seq_exec (serial). Policy hierarchy enables composition: nested_loop_exec for loop tiling and blocking. Backend selection is compile-time; same code compiles to different policies for CUDA/HIP/OpenMP/serial.
**RAJA::View Layout Abstraction**
RAJA::View provides layout-agnostic array access. Template parameters specify: dimensionality, element type, layout (ColMajor/RowMajor), index ordering. STRIDE1 macro converts multi-dimensional indices to linear addresses via layout abstraction. Performance portability: optimal layout differs across architectures (NVIDIA prefers LayoutRight for coalescing, CPUs prefer LayoutLeft for cache).
**Atomic Operations and Team Patterns**
RAJA atomics (AtomicAdd, AtomicMin) port across backends. TeamExecute enables team-level parallelism: outer loop threads (blocks), inner parallel loop (warp/team), team reduction, and barrier synchronization. Synchronous/asynchronous kernels enable flexible execution synchronization.
**CHAI Memory Management**
CHAI (Collected Abstraction of Host and Innovations for Execution) manages data movement between execution spaces. CHAI::ManagedArray automatically migrates data to execution space on access, eliminating explicit host/device transfers. MOVE semantics enable explicit prefetching; COPY semantics enable synchronization. Integration with RAJA is seamless: access CHAI arrays via RAJA kernels, automatic data management.
**Production Adoption**
ARDRA (LLNL radiation hydrodynamics), MFEM (modular finite element methods), and Ares (multiphysics) leverage RAJA. Lawrence Livermore National Laboratory emphasizes RAJA for production codes requiring multi-architecture support (NVIDIA/AMD/CPU).