/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/finiteT/quadrature_integrator_fT.hh Source File#
|
DiFfRG
Discretization Framework for functional Renormalization Group flows
|
quadrature_integrator_fT.hh
Go to the documentation of this file.
28 template <class K> inline constexpr bool kernel_is_matsubara_even = requires { requires K::matsubara_even; };
30 // True iff the kernel declares `static constexpr bool matsubara_finite_extent = true`, i.e. every
37 inline constexpr bool kernel_has_finite_matsubara_extent = requires { requires K::matsubara_finite_extent; };
40 // generated as a MIXED flow and offers two entry points, `kernel_finite_extent` (the terms whose
45 // term's cost is dominated by the single trace it calls, and the generator's CSE is per-function,
48 // half is what runs the full Gaussian rule and the expensive half runs a handful of exact modes.
49 template <class K> inline constexpr bool kernel_has_matsubara_split = requires { requires K::matsubara_split; };
71 QuadratureIntegrator_fT(QuadratureProvider &quadrature_provider, const std::array<size_t, sdim> _grid_size,
94 void set_grid_extents(const std::array<ctype, sdim> grid_min, const std::array<ctype, sdim> grid_max)
219 KOKKOS_INLINE_FUNCTION static NT node_value(const XArr &x, const PosArr &pos, const ArgTuple &args, const ctype xt,
324 device::apply([&](const auto &...iargs) { update += is_first ? KERNEL::constant(iargs...) : NT(0); }, args);
333 void map(ExecutionSpace &space, const view_type integral_view, const Coordinates &coordinates, const Args &...args)
389 Kokkos::view_alloc(space, Kokkos::WithoutInitializing, "QuadratureIntegrator_fT_positions"), need);
394 Kokkos::RangePolicy<ExecutionSpace>(space, 0, integral_view.size()), KOKKOS_LAMBDA(const size_t i) {
415 auto subview = device::apply([&](const auto &...i) { return Kokkos::subview(cache, i...); }, idx);
431 Kokkos::parallel_for(make_kokkos_nd_range_divisible<1 + dim, ExecutionSpace>(space, {0}, extents),
437 auto subview = device::apply([&](const auto &...i) { return Kokkos::subview(cache, i...); }, idx);
451 Kokkos::parallel_for(make_kokkos_nd_range_divisible<1 + dim, ExecutionSpace>(space, {0}, extents),
556 return map_dist(dest + slice.offset, SubCoordinates(coordinates, slice.offset, slice.count), args...);
576 if (m_dest_pinned_size > 0 && MapCompletion::has_pending(m_dest_pinned.data())) MapCompletion::flush();
649 static_assert(sizeof(KERNEL) > 0, "QuadratureIntegrator_fT: the KERNEL type must be complete here. Include the "
665 const bool vacuum = !(T > ctype(0)) || quadrature_provider.template matsubara_predicted_size<ctype>(T, E) >
668 const auto &standard = quadrature_provider.template matsubara_rule<ctype>(vacuum ? ctype(0) : T, E);
700 fe_rule = &quadrature_provider.template matsubara_finite_interval<ctype>(m_extent_margin * m_freq_cutoff,
738 matsubara_nodes = Kokkos::View<const ctype *, mem_space>(m_split_nodes, Kokkos::make_pair(size_t(0), n));
802 device::array<Kokkos::View<const ctype *, typename ExecutionSpace::memory_space>, sdim> weights;
836 mutable typename Kokkos::View<NT, typename ExecutionSpace::memory_space>::host_mirror_type m_result_host;
856 QuadratureIntegrator_fT(QuadratureProvider &quadrature_provider, const std::array<size_t, sdim> _grid_size,
917 if (scheduler.active() && scheduler.plan_contains(this->integrator_id())) MapCompletion::flush();
920 scheduler.schedule(this->integrator_id(), dest, sizeof(NT), coordinates.size(), Base::quadrature_volume(),
930 run_or_queue(dest + slice.offset, SubCoordinates(coordinates, slice.offset, slice.count), args...);
Common base of every integrator, carrying the identity MapScheduler needs.
Definition abstract_integrator.hh:81
static bool deferral_enabled()
Whether the caller has opened a DeferredMaps scope.
Definition map_completion.hh:159
static void record(void *dst, const void *src, const size_t bytes)
Register a device->host result that still has to be copied from staging into dst.
Definition map_completion.hh:73
static bool has_pending(const void *src)
Whether src already has an unlanded result queued.
Definition map_completion.hh:149
static void flush()
Fence, land every pending map result, then exchange slices between MPI ranks.
Definition map_completion.hh:108
static void record_work(std::function< void()> job)
Queue a host-side map() to be run at flush time instead of now.
Definition map_completion.hh:96
static MapScheduler & instance()
A quadrature rule for (bosonic) Matsubara frequencies, based on the method of Monien [1]....
Definition matsubara.hh:25
size_t size() const
Get the size of the quadrature rule, NOT counting the zero mode.
void run_or_queue(NT *dest, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:940
QuadratureIntegrator_fT(QuadratureProvider &quadrature_provider, const std::array< size_t, sdim > _grid_size, std::array< ctype, sdim > grid_min, std::array< ctype, sdim > grid_max, const std::array< QuadratureType, sdim > quadrature_type, const ctype T=1, const ctype typical_E=1)
Definition quadrature_integrator_fT.hh:856
void get(NT &dest, const Args &...t) const
Definition quadrature_integrator_fT.hh:866
auto map(NT *dest, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:912
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition quadrature_integrator_fT.hh:851
void map(execution_space &, NT *dest, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:896
Definition quadrature_integrator_fT.hh:54
Kokkos::View< const ctype *, typename ExecutionSpace::memory_space > matsubara_weights
Definition quadrature_integrator_fT.hh:821
void set_k(const ctype k)
The RG scale, which is the DEFAULT frequency scale.
Definition quadrature_integrator_fT.hh:120
Kokkos::View< NT *, ExecutionSpace > device_scratch(const size_t n)
Grow-only scratch in the integrator's own execution space, reused across calls.
Definition quadrature_integrator_fT.hh:749
device::array< device::array< ctype, sdim >, 2 > grid_extents
Definition quadrature_integrator_fT.hh:795
void run_or_queue_host(NT *dest, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:761
static constexpr int sdim
Spatial dimension of the integration problem.
Definition quadrature_integrator_fT.hh:69
size_t m_n_tail
Nodes before the boundary of the concatenated axis of a split kernel; 0 when not split.
Definition quadrature_integrator_fT.hh:812
static KOKKOS_INLINE_FUNCTION NT node_value(const XArr &x, const PosArr &pos, const ArgTuple &args, const ctype xt, const ctype wt, const bool is_tail)
One Matsubara node's contribution at one spatial point, weight excluded.
Definition quadrature_integrator_fT.hh:219
QuadratureProvider & quadrature_provider
Definition quadrature_integrator_fT.hh:794
device::array< Kokkos::View< const ctype *, typename ExecutionSpace::memory_space >, sdim > nodes
Definition quadrature_integrator_fT.hh:801
void set_matsubara_extent_margin(const ctype margin)
Definition quadrature_integrator_fT.hh:187
void set_allow_exact_matsubara_sum(const bool allow)
Force the exact sum on (or off) regardless of the kernel's trait.
Definition quadrature_integrator_fT.hh:180
void set_frequency_cutoff(const ctype freq_cutoff)
The frequency beyond which the summand is known to vanish, enabling the exact sum.
Definition quadrature_integrator_fT.hh:165
void get(OT &dest, const T &...t) const
Definition quadrature_integrator_fT.hh:289
device::array< ctype, sdim > grid_start
Definition quadrature_integrator_fT.hh:796
void set_typical_E(const ctype typical_E)
The heaviest scale the summand carries, if the model knows it. Zero means "only k".
Definition quadrature_integrator_fT.hh:142
size_t quadrature_volume() const
Points evaluated per external grid point. Half of the scheduler's cost score.
Definition quadrature_integrator_fT.hh:530
ExecutionSpace space
Definition quadrature_integrator_fT.hh:793
device::array< Kokkos::View< const ctype *, typename ExecutionSpace::memory_space >, sdim > weights
Definition quadrature_integrator_fT.hh:802
void run_host(NT *dest, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:776
void get(ExecutionSpace &space, OT &dest, const Args &...t) const
Definition quadrature_integrator_fT.hh:296
auto map(NT *dest, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:539
Kokkos::View< NT *, PinnedHost_memory > m_dest_pinned
Page-locked staging for the device path, so the result copy is genuinely asynchronous.
Definition quadrature_integrator_fT.hh:833
Kokkos::View< NT *, ExecutionSpace > m_dest_device
Definition quadrature_integrator_fT.hh:830
void set_grid_extents(const std::array< ctype, sdim > grid_min, const std::array< ctype, sdim > grid_max)
Definition quadrature_integrator_fT.hh:94
KokkosNDView< 1+dim, NT, ExecutionSpace > m_cache
Definition quadrature_integrator_fT.hh:824
device::array< size_t, dim > grid_size
Definition quadrature_integrator_fT.hh:799
auto map_dist(NT *dest, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:560
device::array< ctype, sdim > grid_scale
Definition quadrature_integrator_fT.hh:797
ctype m_k
The RG scale, which is the frequency scale unless the model set one; see set_k().
Definition quadrature_integrator_fT.hh:806
size_t get_matsubara_size() const
Nodes on the frequency axis, INCLUDING the zero mode.
Definition quadrature_integrator_fT.hh:195
ExecutionSpace execution_space
Execution space to be used for the integration, e.g. GPU_exec, TBB_exec.
Definition quadrature_integrator_fT.hh:63
Kokkos::View< NT, typenameExecutionSpace::memory_space >::host_mirror_type m_result_host
Definition quadrature_integrator_fT.hh:836
void refresh_matsubara()
Re-select and re-fetch the frequency rule after T, k, typical_E or the cutoff changed.
Definition quadrature_integrator_fT.hh:639
void set_T(const ctype T)
Definition quadrature_integrator_fT.hh:106
Kokkos::View< NT, typename ExecutionSpace::memory_space > m_result_view
Definition quadrature_integrator_fT.hh:835
std::string m_positions_key
Definition quadrature_integrator_fT.hh:829
void map(ExecutionSpace &space, const view_type integral_view, const Coordinates &coordinates, const Args &...args)
Definition quadrature_integrator_fT.hh:333
bool uses_exact_matsubara_sum() const
True if the frequency axis is currently the exact sum rather than a Gaussian quadrature rule.
Definition quadrature_integrator_fT.hh:198
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition quadrature_integrator_fT.hh:59
Kokkos::View< const ctype *, typename ExecutionSpace::memory_space > matsubara_nodes
Definition quadrature_integrator_fT.hh:820
void get(NT &dest, const T &...t) const
Definition quadrature_integrator_fT.hh:274
Kokkos::View< ctype *, typename ExecutionSpace::memory_space > m_split_nodes
Definition quadrature_integrator_fT.hh:815
QuadratureIntegrator_fT(QuadratureProvider &quadrature_provider, const std::array< size_t, sdim > _grid_size, std::array< ctype, sdim > grid_min, std::array< ctype, sdim > grid_max, const std::array< QuadratureType, sdim > quadrature_type, const ctype T=1, const ctype typical_E=1)
Definition quadrature_integrator_fT.hh:71
Kokkos::View< ctype *, typename ExecutionSpace::memory_space > m_positions
Definition quadrature_integrator_fT.hh:828
A class that provides quadrature points and weights, in host and device memory. The quadrature points...
Definition quadrature_provider.hh:239
A contiguous window into the linear index range of another coordinate system.
Definition coordinates.hh:207
Definition abstract_integrator.hh:61
constexpr bool has_device_backend
Whether the default execution space is a real device.
Definition map_completion.hh:26
Definition complex_math.hh:10
Kokkos::View< typename GetKokkosNDStarType< dim, T >::type, ExecutionSpace > KokkosNDView
Definition kokkos.hh:182
constexpr bool kernel_is_matsubara_even
Definition quadrature_integrator_fT.hh:28
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
constexpr bool kernel_has_finite_matsubara_extent
Definition quadrature_integrator_fT.hh:37
constexpr bool has_cacheable_positions_v
Whether a coordinates type carries enough identity for QuadratureIntegrator::map() to cache its forwa...
Definition quadrature_integrator.hh:28
Kokkos::View< typename GetKokkosNDStarType< dim, T >::type, ExecutionSpace, Kokkos::MemoryTraits< Kokkos::Restrict > > KokkosNDViewRestrict
Definition kokkos.hh:187
constexpr auto & get(named_tuple< tuple_type, strSet > &ob)
get a reference to the element with the given name
Definition tuples.hh:125
constexpr bool kernel_has_matsubara_split
Definition quadrature_integrator_fT.hh:49
MapTarget map_target()
The scheduling target of an execution space, selected at compile time.
Definition map_scheduler.hh:80
NT TBBReduction(const device::array< size_t, dim > &grid_size, const FUN &functor)
Bitwise reproducible reduction of functor over a dim-dimensional index grid.
Definition tbb.hh:88
auto make_kokkos_nd_view(const std::string &label, const device::array< size_t, dim > &extents)
Definition kokkos.hh:203
bool KOKKOS_INLINE_FUNCTION is_close(T1 a, T2 b, T3 eps_)
Function to evaluate whether two floats are equal to numerical precision. Tests for both relative and...
Definition math.hh:177
This is a functor which wraps a lambda for reduction. Basically, this is necessary when one wants to ...
Definition kokkos.hh:512
This is a functor which wraps a lambda. Basically, this is necessary when one wants to call a variadi...
Definition kokkos.hh:486
This rank's window into the external grid of one QuadratureIntegrator::map() call.
Definition map_scheduler.hh:97
bool owns_all(const size_t grid_size) const
Definition map_scheduler.hh:103
size_t count
Number of grid points; 0 means this rank does not participate in this map().
Definition map_scheduler.hh:101
size_t offset
First external grid point this rank computes.
Definition map_scheduler.hh:99
The CPU execution space: TBB, the one host thread pool DiFfRG runs on.
Definition kokkos.hh:34
Generated by