Block-Structured AMR Software Framework
AMReX_GpuLaunch.nolint.H File Reference

Go to the source code of this file.

Macros

#define AMREX_GET_LAUNCH_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, NAME, ...)   NAME
 
#define AMREX_LAUNCH_DEVICE_LAMBDA(...)
 
#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA(...)
 
#define AMREX_LAUNCH_DEVICE_LAMBDA_DIM(a1, a2, a3, b1, b2, b3, c1, c2, c3)   AMREX_GPU_LAUNCH_DEVICE_LAMBDA_RANGE (a1,a2,a3)
 
#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_DIM(a1, a2, a3, b1, b2, b3, c1, c2, c3)   AMREX_GPU_LAUNCH_HOST_DEVICE_LAMBDA_RANGE(a1,a2,a3)
 
#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_DIM_FLAG(fl, a1, a2, a3, b1, b2, b3, c1, c2, c3)   AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_FLAG(fl,a1,a2,a3)
 
#define AMREX_FOR_1D(...)   AMREX_GPU_DEVICE_FOR_1D(__VA_ARGS__)
 
#define AMREX_FOR_3D(...)   AMREX_GPU_DEVICE_FOR_3D(__VA_ARGS__)
 
#define AMREX_FOR_4D(...)   AMREX_GPU_DEVICE_FOR_4D(__VA_ARGS__)
 
#define AMREX_PARALLEL_FOR_1D(...)   AMREX_GPU_DEVICE_PARALLEL_FOR_1D(__VA_ARGS__)
 
#define AMREX_PARALLEL_FOR_3D(...)   AMREX_GPU_DEVICE_PARALLEL_FOR_3D(__VA_ARGS__)
 
#define AMREX_PARALLEL_FOR_4D(...)   AMREX_GPU_DEVICE_PARALLEL_FOR_4D(__VA_ARGS__)
 
#define AMREX_HOST_DEVICE_FOR_1D(...)   AMREX_GPU_HOST_DEVICE_FOR_1D(__VA_ARGS__)
 
#define AMREX_HOST_DEVICE_FOR_3D(...)   AMREX_GPU_HOST_DEVICE_FOR_3D(__VA_ARGS__)
 
#define AMREX_HOST_DEVICE_FOR_4D(...)   AMREX_GPU_HOST_DEVICE_FOR_4D(__VA_ARGS__)
 
#define AMREX_HOST_DEVICE_PARALLEL_FOR_1D(...)   AMREX_GPU_HOST_DEVICE_PARALLEL_FOR_1D(__VA_ARGS__)
 
#define AMREX_HOST_DEVICE_PARALLEL_FOR_3D(...)   AMREX_GPU_HOST_DEVICE_PARALLEL_FOR_3D(__VA_ARGS__)
 
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D(...)   AMREX_GPU_HOST_DEVICE_PARALLEL_FOR_4D(__VA_ARGS__)
 
#define AMREX_HOST_DEVICE_PARALLEL_FOR_1D_FLAG(where_to_run, n, i, block)
 
#define AMREX_HOST_DEVICE_PARALLEL_FOR_3D_FLAG(where_to_run, box, i, j, k, block)
 
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(where_to_run, box, nc, i, j, k, n, block)
 
#define AMREX_HOST_DEVICE_FOR_1D_FLAG(where_to_run, n, i, block)
 
#define AMREX_HOST_DEVICE_FOR_3D_FLAG(where_to_run, box, i, j, k, block)
 
#define AMREX_HOST_DEVICE_FOR_4D_FLAG(where_to_run, box, nc, i, j, k, n, block)
 
#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_FLAG(where_to_run, box, tbox, block)
 
#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_FLAG(where_to_run, bx1, tbx1, block1)
 
#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_2_FLAG(where_to_run, bx1, tbx1, block1, bx2, tbx2, block2)
 
#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_3_FLAG(where_to_run, bx1, tbx1, block1, bx2, tbx2, block2, bx3, tbx3, block3)
 

Macro Definition Documentation

◆ AMREX_FOR_1D

#define AMREX_FOR_1D (   ...)    AMREX_GPU_DEVICE_FOR_1D(__VA_ARGS__)

◆ AMREX_FOR_3D

#define AMREX_FOR_3D (   ...)    AMREX_GPU_DEVICE_FOR_3D(__VA_ARGS__)

◆ AMREX_FOR_4D

#define AMREX_FOR_4D (   ...)    AMREX_GPU_DEVICE_FOR_4D(__VA_ARGS__)

◆ AMREX_GET_LAUNCH_MACRO

#define AMREX_GET_LAUNCH_MACRO (   _1,
  _2,
  _3,
  _4,
  _5,
  _6,
  _7,
  _8,
  _9,
  NAME,
  ... 
)    NAME

◆ AMREX_HOST_DEVICE_FOR_1D

#define AMREX_HOST_DEVICE_FOR_1D (   ...)    AMREX_GPU_HOST_DEVICE_FOR_1D(__VA_ARGS__)

◆ AMREX_HOST_DEVICE_FOR_1D_FLAG

#define AMREX_HOST_DEVICE_FOR_1D_FLAG (   where_to_run,
  n,
  i,
  block 
)
Value:
{ using amrex_i_inttype = std::remove_const_t<decltype(n)>; \
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
amrex::ParallelFor(n, [=] AMREX_GPU_DEVICE (amrex_i_inttype i) noexcept \
block \
); \
} \
else { \
for (amrex_i_inttype i = 0; i < n; ++i) { \
block \
} \
}}
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
bool inLaunchRegion() noexcept
Definition: AMReX_GpuControl.H:86
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition: AMReX_CTOParallelForImpl.H:200

◆ AMREX_HOST_DEVICE_FOR_3D

#define AMREX_HOST_DEVICE_FOR_3D (   ...)    AMREX_GPU_HOST_DEVICE_FOR_3D(__VA_ARGS__)

◆ AMREX_HOST_DEVICE_FOR_3D_FLAG

#define AMREX_HOST_DEVICE_FOR_3D_FLAG (   where_to_run,
  box,
  i,
  j,
  k,
  block 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
amrex::ParallelFor(box, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept \
block \
); \
} \
else { \
amrex::LoopOnCpu(box, [=] (int i, int j, int k) noexcept \
block \
); \
}
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:355

◆ AMREX_HOST_DEVICE_FOR_4D

#define AMREX_HOST_DEVICE_FOR_4D (   ...)    AMREX_GPU_HOST_DEVICE_FOR_4D(__VA_ARGS__)

◆ AMREX_HOST_DEVICE_FOR_4D_FLAG

#define AMREX_HOST_DEVICE_FOR_4D_FLAG (   where_to_run,
  box,
  nc,
  i,
  j,
  k,
  n,
  block 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
amrex::ParallelFor(box, nc, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept \
block \
); \
} \
else { \
amrex::LoopOnCpu(box, nc, [=] (int i, int j, int k, int n) noexcept \
block \
); \
}

◆ AMREX_HOST_DEVICE_PARALLEL_FOR_1D

#define AMREX_HOST_DEVICE_PARALLEL_FOR_1D (   ...)    AMREX_GPU_HOST_DEVICE_PARALLEL_FOR_1D(__VA_ARGS__)

◆ AMREX_HOST_DEVICE_PARALLEL_FOR_1D_FLAG

#define AMREX_HOST_DEVICE_PARALLEL_FOR_1D_FLAG (   where_to_run,
  n,
  i,
  block 
)
Value:
{ using amrex_i_inttype = std::remove_const_t<decltype(n)>; \
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
amrex::ParallelFor(n, [=] AMREX_GPU_DEVICE (amrex_i_inttype i) noexcept \
block \
); \
} \
else { \
AMREX_PRAGMA_SIMD \
for (amrex_i_inttype i = 0; i < n; ++i) { \
block \
} \
}}

◆ AMREX_HOST_DEVICE_PARALLEL_FOR_3D

#define AMREX_HOST_DEVICE_PARALLEL_FOR_3D (   ...)    AMREX_GPU_HOST_DEVICE_PARALLEL_FOR_3D(__VA_ARGS__)

◆ AMREX_HOST_DEVICE_PARALLEL_FOR_3D_FLAG

#define AMREX_HOST_DEVICE_PARALLEL_FOR_3D_FLAG (   where_to_run,
  box,
  i,
  j,
  k,
  block 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
amrex::ParallelFor(box, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept \
block \
); \
} \
else { \
amrex::LoopConcurrentOnCpu(box, [=] (int i, int j, int k) noexcept \
block \
); \
}
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopConcurrentOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:378

◆ AMREX_HOST_DEVICE_PARALLEL_FOR_4D

#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D (   ...)    AMREX_GPU_HOST_DEVICE_PARALLEL_FOR_4D(__VA_ARGS__)

◆ AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG

#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG (   where_to_run,
  box,
  nc,
  i,
  j,
  k,
  n,
  block 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
amrex::ParallelFor(box, nc, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept \
block \
); \
} \
else { \
amrex::LoopConcurrentOnCpu(box, nc, [=] (int i, int j, int k, int n) noexcept \
block \
); \
}

◆ AMREX_LAUNCH_DEVICE_LAMBDA

#define AMREX_LAUNCH_DEVICE_LAMBDA (   ...)
Value:
AMREX_GET_LAUNCH_MACRO(__VA_ARGS__,\
AMREX_WRONG_NUM_ARGS)(__VA_ARGS__)
#define AMREX_GPU_LAUNCH_DEVICE_LAMBDA_RANGE_2(...)
Definition: AMReX_GpuLaunchMacrosC.nolint.H:35
#define AMREX_GPU_LAUNCH_DEVICE_LAMBDA_RANGE(...)
Definition: AMReX_GpuLaunchMacrosC.nolint.H:34
#define AMREX_GPU_LAUNCH_DEVICE_LAMBDA_RANGE_3(...)
Definition: AMReX_GpuLaunchMacrosC.nolint.H:36
#define AMREX_GET_LAUNCH_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, NAME,...)
Definition: AMReX_GpuLaunch.nolint.H:4
#define AMREX_WRONG_NUM_ARGS(...)
Definition: AMReX_GpuQualifiers.H:67

◆ AMREX_LAUNCH_DEVICE_LAMBDA_DIM

#define AMREX_LAUNCH_DEVICE_LAMBDA_DIM (   a1,
  a2,
  a3,
  b1,
  b2,
  b3,
  c1,
  c2,
  c3 
)    AMREX_GPU_LAUNCH_DEVICE_LAMBDA_RANGE (a1,a2,a3)

◆ AMREX_LAUNCH_HOST_DEVICE_LAMBDA

#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA (   ...)
Value:
AMREX_GET_LAUNCH_MACRO(__VA_ARGS__,\
AMREX_WRONG_NUM_ARGS)(__VA_ARGS__)
#define AMREX_GPU_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_3(TN1, TI1, block1, TN2, TI2, block2, TN3, TI3, block3)
Definition: AMReX_GpuLaunchMacrosC.nolint.H:21
#define AMREX_GPU_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_2(TN1, TI1, block1, TN2, TI2, block2)
Definition: AMReX_GpuLaunchMacrosC.nolint.H:11
#define AMREX_GPU_LAUNCH_HOST_DEVICE_LAMBDA_RANGE(TN, TI, block)
Definition: AMReX_GpuLaunchMacrosC.nolint.H:4

◆ AMREX_LAUNCH_HOST_DEVICE_LAMBDA_DIM

#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_DIM (   a1,
  a2,
  a3,
  b1,
  b2,
  b3,
  c1,
  c2,
  c3 
)    AMREX_GPU_LAUNCH_HOST_DEVICE_LAMBDA_RANGE(a1,a2,a3)

◆ AMREX_LAUNCH_HOST_DEVICE_LAMBDA_DIM_FLAG

#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_DIM_FLAG (   fl,
  a1,
  a2,
  a3,
  b1,
  b2,
  b3,
  c1,
  c2,
  c3 
)    AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_FLAG(fl,a1,a2,a3)

◆ AMREX_LAUNCH_HOST_DEVICE_LAMBDA_FLAG

#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_FLAG (   where_to_run,
  box,
  tbox,
  block 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
AMREX_LAUNCH_DEVICE_LAMBDA(box,tbox,block); \
} else { \
auto tbox = box; \
block; \
}

◆ AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_2_FLAG

#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_2_FLAG (   where_to_run,
  bx1,
  tbx1,
  block1,
  bx2,
  tbx2,
  block2 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
AMREX_LAUNCH_DEVICE_LAMBDA(bx1,tbx1,block1,bx2,tbx2,block2); \
} else { \
auto tbx1 = bx1; \
auto tbx2 = bx2; \
block1; \
block2; \
}

◆ AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_3_FLAG

#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_3_FLAG (   where_to_run,
  bx1,
  tbx1,
  block1,
  bx2,
  tbx2,
  block2,
  bx3,
  tbx3,
  block3 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
AMREX_LAUNCH_DEVICE_LAMBDA(bx1,tbx1,block1,bx2,tbx2,block2,bx3,tbx3,block3); \
} else { \
auto tbx1 = bx1; \
auto tbx2 = bx2; \
auto tbx3 = bx3; \
block1; \
block2; \
block3; \
}

◆ AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_FLAG

#define AMREX_LAUNCH_HOST_DEVICE_LAMBDA_RANGE_FLAG (   where_to_run,
  bx1,
  tbx1,
  block1 
)
Value:
if ((where_to_run == RunOn::Device) && (Gpu::inLaunchRegion())) \
{ \
AMREX_LAUNCH_DEVICE_LAMBDA(bx1,tbx1,block1); \
} else { \
auto tbx1 = bx1; \
block1; \
}

◆ AMREX_PARALLEL_FOR_1D

#define AMREX_PARALLEL_FOR_1D (   ...)    AMREX_GPU_DEVICE_PARALLEL_FOR_1D(__VA_ARGS__)

◆ AMREX_PARALLEL_FOR_3D

#define AMREX_PARALLEL_FOR_3D (   ...)    AMREX_GPU_DEVICE_PARALLEL_FOR_3D(__VA_ARGS__)

◆ AMREX_PARALLEL_FOR_4D

#define AMREX_PARALLEL_FOR_4D (   ...)    AMREX_GPU_DEVICE_PARALLEL_FOR_4D(__VA_ARGS__)