include/pops/mesh/storage/mf_arith.hpp File ReferenceΒΆ

adc_cpp: include/pops/mesh/storage/mf_arith.hpp File Reference
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
mf_arith.hpp File Reference

MultiFab arithmetic (saxpy, lincomb, norm_inf, dot) over VALID cells. More...

#include <pops/core/foundation/types.hpp>
#include <pops/mesh/index/box2d.hpp>
#include <pops/mesh/storage/fab2d.hpp>
#include <pops/mesh/execution/for_each.hpp>
#include <pops/mesh/storage/multifab.hpp>
#include <pops/parallel/comm.hpp>
#include <algorithm>
#include <limits>
+ Include dependency graph for mf_arith.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::detail::SaxpyKernel
 
struct  pops::detail::LincombKernel
 
struct  pops::detail::NormInfKernel
 
struct  pops::detail::DotKernel
 
struct  pops::detail::SumKernel
 
struct  pops::detail::MaxKernel
 
struct  pops::detail::MinKernel
 

Namespaces

namespace  pops
 
namespace  pops::detail
 

Functions

void pops::saxpy (MultiFab &y, Real a, const MultiFab &x)
 y <- y + a x over ALL components of the valid cells. Identical layouts required.
 
Real pops::norm_inf (const MultiFab &mf, int comp=0)
 Infinity norm max |f(.,.,comp)| over the valid cells (LOCAL, without MPI all_reduce).
 
void pops::lincomb (MultiFab &z, Real a, const MultiFab &x, Real b, const MultiFab &y)
 z <- a x + b y over ALL components of the valid cells. Identical layouts; aliasing safe.
 
Real pops::dot (const MultiFab &x, const MultiFab &y, int comp=0)
 Dot product Sum_cells x.y over component comp, reduced over ALL ranks (all_reduce).
 
Real pops::dot_all (const MultiFab &x, const MultiFab &y)
 FULL-component dot Sum_{cells, c} x(.,.,c) * y(.,.,c) over ALL components, reduced over ALL ranks (all_reduce).
 
Real pops::reduce_sum (const MultiFab &mf, int comp=0)
 Sum Sum_cells f(.,.,comp) over component comp, reduced over ALL ranks (all_reduce_sum) – the compiled-Program P.sum / P.sum_component reduction.
 
Real pops::reduce_max (const MultiFab &mf, int comp=0)
 Signed maximum max_cells f(.,.,comp) over component comp, reduced over ALL ranks (all_reduce_max) – the compiled-Program P.max reduction (SIGNED, not the magnitude – use norm_inf for max|f|).
 
Real pops::reduce_min (const MultiFab &mf, int comp=0)
 Signed minimum min_cells f(.,.,comp) over component comp, reduced over ALL ranks (all_reduce_min) – the compiled-Program P.min reduction.
 

Detailed Description

MultiFab arithmetic (saxpy, lincomb, norm_inf, dot) over VALID cells.

Building blocks for integrator stages and Krylov solvers. Assumes IDENTICAL layouts (same BoxArray, same DistributionMapping). Pointwise operations -> ALIASING is safe (x or y == z allowed). norm_inf / dot go through the reducer seam (true Kokkos reduction). dot performs a COLLECTIVE all_reduce: it MUST be called on EVERY rank (including a rank with no box) under MPI, otherwise deadlock. FP NOTE: dot/sum are re-associated per tile (Kokkos::Sum, deterministic/idempotent but not bit-identical to a lexicographic sum, for all Kokkos spaces); norm_inf is exact everywhere. The kernels are device-clean NAMED FUNCTORS (nvcc cross-TU).