Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
Execution and Kernel Launch

Facilities for expressing parallel computation and launching performance-portable kernels in AMReX. More...

Functions

template<std::integral T, typename L >
void amrex::ParallelForOMP (T n, L const &f) noexcept
 Performance-portable kernel launch function with optional OpenMP threading.
 
template<typename L >
void amrex::ParallelForOMP (Box const &box, L const &f) noexcept
 Performance-portable kernel launch function with optional OpenMP threading.
 
template<std::integral T, typename L >
void amrex::ParallelForOMP (Box const &box, T ncomp, L const &f) noexcept
 Performance-portable kernel launch function with optional OpenMP threading.
 
template<int MT, std::integral T, typename L >
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &, T n, L const &f)
 Performance-portable kernel launch function.
 
template<int MT, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &, BoxND< dim > const &box, L const &f)
 Performance-portable kernel launch function.
 
template<int MT, std::integral T, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &, BoxND< dim > const &box, T ncomp, L const &f)
 Performance-portable kernel launch function.
 
template<std::integral T, typename L >
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelForRNG (T n, L const &f)
 Performance-portable kernel launch function with random number generation support.
 
template<typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelForRNG (BoxND< dim > const &box, L const &f)
 Performance-portable kernel launch function with random number generation support.
 
template<std::integral T, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelForRNG (BoxND< dim > const &box, T ncomp, L const &f)
 Performance-portable kernel launch function with random number generation support.
 
template<int MT, typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &, BoxND< dim > const &box1, BoxND< dim > const &box2, L1 &&f1, L2 &&f2)
 Performance-portable kernel launch function.
 
template<int MT, typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &, BoxND< dim > const &box1, BoxND< dim > const &box2, BoxND< dim > const &box3, L1 &&f1, L2 &&f2, L3 &&f3)
 Performance-portable kernel launch function.
 
template<int MT, std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &, BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2)
 Performance-portable kernel launch function.
 
template<int MT, std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &, BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2, BoxND< dim > const &box3, T3 ncomp3, L3 &&f3)
 Performance-portable kernel launch function.
 
template<std::integral T, typename L >
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &info, T n, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &info, BoxND< dim > const &box, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<std::integral T, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &info, BoxND< dim > const &box, T ncomp, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &info, BoxND< dim > const &box1, BoxND< dim > const &box2, L1 &&f1, L2 &&f2) noexcept
 Performance-portable kernel launch function.
 
template<typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &info, BoxND< dim > const &box1, BoxND< dim > const &box2, BoxND< dim > const &box3, L1 &&f1, L2 &&f2, L3 &&f3) noexcept
 Performance-portable kernel launch function.
 
template<std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &info, BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2) noexcept
 Performance-portable kernel launch function.
 
template<std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor (Gpu::KernelInfo const &info, BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2, BoxND< dim > const &box3, T3 ncomp3, L3 &&f3) noexcept
 Performance-portable kernel launch function.
 
template<std::integral T, typename L >
void amrex::ParallelFor (T n, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<int MT, std::integral T, typename L >
void amrex::ParallelFor (T n, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<typename L , int dim>
void amrex::ParallelFor (BoxND< dim > const &box, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<int MT, typename L , int dim>
void amrex::ParallelFor (BoxND< dim > const &box, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<std::integral T, typename L , int dim>
void amrex::ParallelFor (BoxND< dim > const &box, T ncomp, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<int MT, std::integral T, typename L , int dim>
void amrex::ParallelFor (BoxND< dim > const &box, T ncomp, L &&f) noexcept
 Performance-portable kernel launch function.
 
template<typename L1 , typename L2 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, BoxND< dim > const &box2, L1 &&f1, L2 &&f2) noexcept
 Performance-portable kernel launch function.
 
template<int MT, typename L1 , typename L2 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, BoxND< dim > const &box2, L1 &&f1, L2 &&f2) noexcept
 Performance-portable kernel launch function.
 
template<typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, BoxND< dim > const &box2, BoxND< dim > const &box3, L1 &&f1, L2 &&f2, L3 &&f3) noexcept
 Performance-portable kernel launch function.
 
template<int MT, typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, BoxND< dim > const &box2, BoxND< dim > const &box3, L1 &&f1, L2 &&f2, L3 &&f3) noexcept
 Performance-portable kernel launch function.
 
template<std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2) noexcept
 Performance-portable kernel launch function.
 
template<int MT, std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2) noexcept
 Performance-portable kernel launch function.
 
template<std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2, BoxND< dim > const &box3, T3 ncomp3, L3 &&f3) noexcept
 Performance-portable kernel launch function.
 
template<int MT, std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor (BoxND< dim > const &box1, T1 ncomp1, L1 &&f1, BoxND< dim > const &box2, T2 ncomp2, L2 &&f2, BoxND< dim > const &box3, T3 ncomp3, L3 &&f3) noexcept
 Performance-portable kernel launch function.
 

Detailed Description

Facilities for expressing parallel computation and launching performance-portable kernels in AMReX.

These interfaces provide a unified way to execute computational kernels on CPUs and GPUs without exposing backend-specific programming models.

Key functions and classes include:

Function Documentation

◆ ParallelFor() [1/28]

template<int MT, typename L , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [2/28]

template<int MT, std::integral T, typename L , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box,
ncomp,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [3/28]

template<typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
BoxND< dim > const &  box3,
L1 &&  f1,
L2 &&  f2,
L3 &&  f3 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [4/28]

template<int MT, typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
BoxND< dim > const &  box3,
L1 &&  f1,
L2 &&  f2,
L3 &&  f3 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [5/28]

template<typename L1 , typename L2 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
L1 &&  f1,
L2 &&  f2 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [6/28]

template<int MT, typename L1 , typename L2 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
L1 &&  f1,
L2 &&  f2 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [7/28]

template<std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [8/28]

template<int MT, std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [9/28]

template<std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2,
BoxND< dim > const &  box3,
T3  ncomp3,
L3 &&  f3 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [10/28]

template<int MT, std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2,
BoxND< dim > const &  box3,
T3  ncomp3,
L3 &&  f3 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [11/28]

template<typename L , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [12/28]

template<std::integral T, typename L , int dim>
void amrex::ParallelFor ( BoxND< dim > const &  box,
ncomp,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [13/28]

template<int MT, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  ,
BoxND< dim > const &  box,
L const &  f 
)

Performance-portable kernel launch function.

◆ ParallelFor() [14/28]

template<int MT, std::integral T, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  ,
BoxND< dim > const &  box,
ncomp,
L const &  f 
)

Performance-portable kernel launch function.

◆ ParallelFor() [15/28]

template<int MT, typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  ,
BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
BoxND< dim > const &  box3,
L1 &&  f1,
L2 &&  f2,
L3 &&  f3 
)

Performance-portable kernel launch function.

◆ ParallelFor() [16/28]

template<int MT, typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  ,
BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
L1 &&  f1,
L2 &&  f2 
)

Performance-portable kernel launch function.

◆ ParallelFor() [17/28]

template<int MT, std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  ,
BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2 
)

Performance-portable kernel launch function.

◆ ParallelFor() [18/28]

template<int MT, std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  ,
BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2,
BoxND< dim > const &  box3,
T3  ncomp3,
L3 &&  f3 
)

Performance-portable kernel launch function.

◆ ParallelFor() [19/28]

template<int MT, std::integral T, typename L >
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  ,
n,
L const &  f 
)

Performance-portable kernel launch function.

◆ ParallelFor() [20/28]

template<typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  info,
BoxND< dim > const &  box,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [21/28]

template<std::integral T, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  info,
BoxND< dim > const &  box,
ncomp,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [22/28]

template<typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  info,
BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
BoxND< dim > const &  box3,
L1 &&  f1,
L2 &&  f2,
L3 &&  f3 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [23/28]

template<typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  info,
BoxND< dim > const &  box1,
BoxND< dim > const &  box2,
L1 &&  f1,
L2 &&  f2 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [24/28]

template<std::integral T1, std::integral T2, typename L1 , typename L2 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  info,
BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [25/28]

template<std::integral T1, std::integral T2, std::integral T3, typename L1 , typename L2 , typename L3 , int dim>
requires (MaybeDeviceRunnable<L1>::value && MaybeDeviceRunnable<L2>::value && MaybeDeviceRunnable<L3>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  info,
BoxND< dim > const &  box1,
T1  ncomp1,
L1 &&  f1,
BoxND< dim > const &  box2,
T2  ncomp2,
L2 &&  f2,
BoxND< dim > const &  box3,
T3  ncomp3,
L3 &&  f3 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [26/28]

template<std::integral T, typename L >
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelFor ( Gpu::KernelInfo const &  info,
n,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [27/28]

template<int MT, std::integral T, typename L >
void amrex::ParallelFor ( n,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelFor() [28/28]

template<std::integral T, typename L >
void amrex::ParallelFor ( n,
L &&  f 
)
noexcept

Performance-portable kernel launch function.

◆ ParallelForOMP() [1/3]

template<typename L >
void amrex::ParallelForOMP ( Box const &  box,
L const &  f 
)
noexcept

Performance-portable kernel launch function with optional OpenMP threading.

For GPU builds and for CPU builds without OpenMP support, this is the same as ParalleFor. For CPU builds with OpenMP enabled, this function uses OpenMP threading.

◆ ParallelForOMP() [2/3]

template<std::integral T, typename L >
void amrex::ParallelForOMP ( Box const &  box,
ncomp,
L const &  f 
)
noexcept

Performance-portable kernel launch function with optional OpenMP threading.

For GPU builds and for CPU builds without OpenMP support, this is the same as ParalleFor. For CPU builds with OpenMP enabled, this function uses OpenMP threading.

◆ ParallelForOMP() [3/3]

template<std::integral T, typename L >
void amrex::ParallelForOMP ( n,
L const &  f 
)
noexcept

Performance-portable kernel launch function with optional OpenMP threading.

For GPU builds and for CPU builds without OpenMP support, this is the same as ParalleFor. For CPU builds with OpenMP enabled, this function uses OpenMP threading.

◆ ParallelForRNG() [1/3]

template<typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelForRNG ( BoxND< dim > const &  box,
L const &  f 
)

Performance-portable kernel launch function with random number generation support.

◆ ParallelForRNG() [2/3]

template<std::integral T, typename L , int dim>
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelForRNG ( BoxND< dim > const &  box,
ncomp,
L const &  f 
)

Performance-portable kernel launch function with random number generation support.

◆ ParallelForRNG() [3/3]

template<std::integral T, typename L >
requires (MaybeDeviceRunnable<L>::value)
void amrex::ParallelForRNG ( n,
L const &  f 
)

Performance-portable kernel launch function with random number generation support.