9#include <rmm/cuda_stream_pool.hpp>
10#include <rmm/device_uvector.hpp>
11#include <rmm/mr/device/pool_memory_resource.hpp>
12#include <thrust/reduce.h>
13#include <thrust/transform_reduce.h>
50 const NT res = std::apply([&](
auto &&...args) {
return KERNEL::kernel(q,
k, args...); },
t);
51 return int_element * res * weight;
59 const std::tuple<T...>
t;
63 const uint max_block_size = 256)
75 const uint max_block_size = 256)
99 template <
typename... T> NT
get(
const ctype k,
const T &...t)
const
101 return KERNEL::constant(k, t...) +
102 thrust::transform_reduce(
103 thrust::cuda::par.on(rmm::cuda_stream_per_thread.value()), thrust::make_counting_iterator<uint>(0),
104 thrust::make_counting_iterator<uint>(
grid_size),
118 template <
typename... T> std::future<NT>
request(
const ctype k,
const T &...t)
const
120 return std::async(std::launch::deferred, [=,
this]() {
return get(k, t...); });
139 template <
int d,
typename NT,
typename KERNEL>
class IntegratorGPU;
148 template <
int d,
typename NT,
typename KERNEL>
class IntegratorGPU :
public IntegratorTBB<d, NT, KERNEL>
154 const uint max_block_size = 256)
157 (void)max_block_size;
161 const uint max_block_size = 256)
164 (void)max_block_size;
Definition integrator_gpu.hh:22
IntegratorGPU(const IntegratorGPU &other)
Definition integrator_gpu.hh:83
const ctype x_extent
Definition integrator_gpu.hh:129
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition integrator_gpu.hh:27
NT get(const ctype k, const T &...t) const
Get the integral of the kernel.
Definition integrator_gpu.hh:99
IntegratorGPU(QuadratureProvider &quadrature_provider, const std::array< uint, 1 > grid_size, const ctype x_extent, const JSONValue &json)
Definition integrator_gpu.hh:68
const uint grid_size
Definition integrator_gpu.hh:124
const ctype * ptr_x_quadrature_p
Definition integrator_gpu.hh:126
const ctype * ptr_x_quadrature_w
Definition integrator_gpu.hh:127
IntegratorGPU(QuadratureProvider &quadrature_provider, const std::array< uint, 1 > grid_size, const ctype x_extent, const uint max_block_size=256)
Definition integrator_gpu.hh:62
IntegratorGPU(QuadratureProvider &quadrature_provider, const uint grid_size, const ctype x_extent, const uint max_block_size=256)
Definition integrator_gpu.hh:74
std::future< NT > request(const ctype k, const T &...t) const
Request a future for the integral of the kernel.
Definition integrator_gpu.hh:118
A wrapper around the boost json value class.
Definition json.hh:19
A class that provides quadrature points and weights, in host and device memory. The quadrature points...
Definition quadrature_provider.hh:139
const NT * get_device_weights(const size_t order, const int device=0, const QuadratureType type=QuadratureType::legendre)
Get the device-side quadrature weights for a quadrature of size quadrature_size.
Definition quadrature_provider.hh:211
const NT * get_device_points(const size_t order, const int device=0, const QuadratureType type=QuadratureType::legendre)
Get the device-side quadrature points for a quadrature of size quadrature_size.
Definition quadrature_provider.hh:198
typename internal::_ctype< CT >::value ctype
Definition types.hh:106
Definition complex_math.hh:14
constexpr __forceinline__ __host__ __device__ NumberType powr(const NumberType x)
A compile-time evaluatable power function for whole number exponents.
Definition math.hh:45
constexpr __forceinline__ __host__ __device__ double S_d(NT d)
Surface of a d-dimensional sphere.
Definition math.hh:91
consteval NT S_d_prec(uint d)
Surface of a d-dimensional sphere (precompiled)
Definition math.hh:104
unsigned int uint
Definition utils.hh:22
Custom functor for the thrust::transform_reduce function.
Definition integrator_gpu.hh:34
const ctype x_extent
Definition integrator_gpu.hh:57
__device__ NT operator()(const uint idx) const
Definition integrator_gpu.hh:41
const ctype * x_quadrature_w
Definition integrator_gpu.hh:56
functor(const ctype *x_quadrature_p, const ctype *x_quadrature_w, const ctype x_extent, const ctype k, T... t)
Definition integrator_gpu.hh:36
const ctype * x_quadrature_p
Definition integrator_gpu.hh:55
const ctype k
Definition integrator_gpu.hh:58
const std::tuple< T... > t
Definition integrator_gpu.hh:59