/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/kokkos.hh Source File#
|
DiFfRG
Discretization Framework for functional Renormalization Group flows
|
kokkos.hh
Go to the documentation of this file.
77 // We assume that this is true, and when switching to a different memory space, it is always unique.
80 static_assert(std::is_same_v<CPU_memory, TBB_memory>, "CPU memory space must be the same as TBB memory space");
182 using KokkosNDView = Kokkos::View<typename GetKokkosNDStarType<dim, T>::type, // Get the star syntax for
188 Kokkos::View<typename GetKokkosNDStarType<dim, T>::type, // Get the star syntax for dimensionality recursively
196 Kokkos::View<typename GetKokkosNDStarType<dim, T>::type, // Get the star syntax for dimensionality recursively
205 return device::apply([&](const auto &...args) { return KokkosNDView<dim, T, ExecutionSpace>(label, args...); },
210 auto make_kokkos_nd_view_restrict(const std::string &label, const device::array<size_t, dim> &extents)
213 [&](const auto &...args) { return KokkosNDViewRestrict<dim, T, ExecutionSpace>(label, args...); }, extents);
219 // Pin launch bounds. Without __launch_bounds__ ptxas cannot see the block size and pins registers
220 // differently; measured ~3-14% slower across the YangMills flow set on sm_89, results identical
241 template <int dim, typename ExecutionSpace> using KokkosNDRange = KokkosNDRangeHelper<dim, ExecutionSpace>::type;
246 // min(512, LaunchBounds::maxTperB) -- so every tile dimension it can produce is the recommendation
247 // divided by a power of two. When an extent is not a multiple of that, the boundary tile launches
251 // LB=128 gives tile {16,2,4,1,1} on the rank-5 flows: extent 6 against tile 4 is ceil(6/4)=2 tiles
252 // covering 8 slots, i.e. 4/3 of the threads launched for 1 unit of work. Since dim0 x dim1 = 32 is
253 // exactly one warp, the masked lanes form whole dead warps. Measured masked fractions at LB=128
255 // with_mesons_3D 1.299x, finite_T no_mesons 1.314x -- and YangMills 1.000x, because its angular
258 // This is what the A100 LaunchBounds sweep actually measured. LB=96 and LB=64 both collapse the
260 // *byte-identical* registers (255), spill (1864 B) and occupancy (12.5%), which no occupancy story
261 // explains. Per-flow it splits perfectly: the three rank-5 flows (the only ones with masked lanes)
373 device::array<size_t, dim> compute_tile_hints(const device::array<size_t, dim> &extents, size_t max_threads = 256)
437 auto make_kokkos_nd_range_divisible(ExecutionSpace &space, const device::array<size_t, dim> start,
461 KOKKOS_FORCEINLINE_FUNCTION auto make_kokkos_nd_thread_range(const TeamType &team, const device::array<size_t, dim> end)
527 KOKKOS_FORCEINLINE_FUNCTION void impl(device::integer_sequence<size_t, Is...>, Args &&...args) const
530 fun(device::array<size_t, dim>{{static_cast<size_t>(device::get<Is>(tuple))...}}, device::get<dim>(tuple));
Definition kokkos.hh:40
TBB_exec_space::memory_space TBB_memory_space
Definition kokkos.hh:49
Kokkos::DefaultExecutionSpace GPU_exec_space
Definition kokkos.hh:42
Kokkos::DefaultHostExecutionSpace KokkosHost_exec_space
Definition kokkos.hh:45
KokkosHost_exec_space::memory_space KokkosHost_memory_space
Definition kokkos.hh:46
GPU_exec_space::memory_space GPU_memory_space
Definition kokkos.hh:43
Definition complex_math.hh:10
Kokkos::View< typename GetKokkosNDStarType< dim, T >::type, ExecutionSpace > KokkosNDView
Definition kokkos.hh:182
auto make_kokkos_nd_range(ExecutionSpace &space, const device::array< size_t, dim > start, const device::array< size_t, dim > end)
Definition kokkos.hh:390
auto make_kokkos_nd_range_divisible(ExecutionSpace &space, const device::array< size_t, dim > start, const device::array< size_t, dim > end)
Like make_kokkos_nd_range, but re-tiled so no lane is launched masked.
Definition kokkos.hh:437
device::array< size_t, dim > compute_tile_hints(const device::array< size_t, dim > &extents, size_t max_threads=256)
Compute clamped tile sizes for MDRangePolicy so that the product of tile dimensions does not exceed m...
Definition kokkos.hh:373
Kokkos::View< typename GetKokkosNDStarType< dim, T >::type, ExecutionSpace, Kokkos::MemoryTraits< Kokkos::Unmanaged > > KokkosNDViewUnmanaged
Definition kokkos.hh:195
Kokkos::View< typename GetKokkosNDStarType< dim, T >::type, ExecutionSpace, Kokkos::MemoryTraits< Kokkos::Restrict > > KokkosNDViewRestrict
Definition kokkos.hh:187
CPU_memory PinnedHost_memory
Host memory the device can DMA to/from without staging, i.e. page-locked.
Definition kokkos.hh:69
@ device
auto make_kokkos_nd_view_restrict(const std::string &label, const device::array< size_t, dim > &extents)
Definition kokkos.hh:210
device::array< size_t, dim > compute_divisible_tile(const device::array< size_t, dim > &extents, const device::array< size_t, dim > &kokkos_tile, size_t budget)
A tile whose every dimension divides its extent, so no lane is launched masked.
Definition kokkos.hh:286
ExecutionSpaces::KokkosHost_exec_space KokkosHost_exec
Definition kokkos.hh:73
KOKKOS_FORCEINLINE_FUNCTION auto make_kokkos_nd_thread_range(const TeamType &team, const device::array< size_t, dim > end)
Definition kokkos.hh:461
ExecutionSpaces::KokkosHost_memory_space KokkosHost_memory
Definition kokkos.hh:53
auto make_kokkos_nd_view(const std::string &label, const device::array< size_t, dim > &extents)
Definition kokkos.hh:203
KokkosNDRangeHelper< dim, ExecutionSpace >::type KokkosNDRange
Definition kokkos.hh:241
Definition kokkos.hh:538
Definition complex_math.hh:19
Definition kokkos.hh:170
typename GetKokkosNDStarType< dim - 1, T >::type * type
Definition kokkos.hh:171
This is a functor which wraps a lambda for reduction. Basically, this is necessary when one wants to ...
Definition kokkos.hh:512
KOKKOS_FORCEINLINE_FUNCTION void impl(device::integer_sequence< size_t, Is... >, Args &&...args) const
Definition kokkos.hh:527
KOKKOS_FUNCTION KokkosNDLambdaWrapperReduction(const FUN &_fun)
Definition kokkos.hh:514
KOKKOS_FORCEINLINE_FUNCTION void operator()(Args &&...args) const
Definition kokkos.hh:518
This is a functor which wraps a lambda. Basically, this is necessary when one wants to call a variadi...
Definition kokkos.hh:486
KOKKOS_FORCEINLINE_FUNCTION void operator()(Args &&...args) const
Definition kokkos.hh:492
KOKKOS_FUNCTION KokkosNDLambdaWrapper(const FUN &_fun)
Definition kokkos.hh:488
Kokkos::RangePolicy< ExecutionSpace, Kokkos::LaunchBounds< DIFFRG_LAUNCH_BOUNDS > > type
Definition kokkos.hh:238
Definition kokkos.hh:233
Kokkos::MDRangePolicy< Kokkos::Rank< dim >, ExecutionSpace, Kokkos::LaunchBounds< DIFFRG_LAUNCH_BOUNDS > > type
Definition kokkos.hh:234
An extension of the Kokkos::Sum reducer that adds a constant value to the result.
Definition kokkos.hh:88
KOKKOS_INLINE_FUNCTION SumPlus(value_type &value_, const saved_type &plus_value_)
Definition kokkos.hh:106
KOKKOS_INLINE_FUNCTION bool references_scalar() const
Definition kokkos.hh:131
KOKKOS_INLINE_FUNCTION SumPlus(const result_view_type &value_, const saved_type &plus_value_)
Definition kokkos.hh:112
KOKKOS_INLINE_FUNCTION value_type & reference() const
Definition kokkos.hh:125
Kokkos::View< value_type, Space > result_view_type
Definition kokkos.hh:96
KOKKOS_INLINE_FUNCTION void join(value_type &dest, const value_type &src) const
Definition kokkos.hh:119
KOKKOS_INLINE_FUNCTION void init(value_type &val) const
Definition kokkos.hh:122
The CPU execution space: TBB, the one host thread pool DiFfRG runs on.
Definition kokkos.hh:34
Kokkos::DefaultHostExecutionSpace::memory_space memory_space
Definition kokkos.hh:35
static KOKKOS_FORCEINLINE_FUNCTION autodiff::Real< N, T > sum()
Definition kokkos.hh:540
Generated by