SplineInterpolator1DStack< NT, Coordinates > Class Template Reference#
|
DiFfRG
Discretization Framework for functional Renormalization Group flows
|
A stack of 1D splines, callable from host AND device code. More...
#include <spline_interpolator_1d_stack.hh>
Public Types | |
| using | ctype = typename Coordinates::ctype |
| using | value_type = NT |
Public Member Functions | |
| SplineInterpolator1DStack (const Coordinates &coordinates) | |
| Construct a SplineInterpolator1DStack with zeroed data and a coordinate system. | |
| KOKKOS_DEFAULTED_FUNCTION | SplineInterpolator1DStack (const SplineInterpolator1DStack &)=default |
| Shallow copy of ALL views, valid in host and in device code. See LinearInterpolator1D. | |
| template<typename NT2 > | |
| void | update (const NT2 *in_data, const ctype lower_y1=std::numeric_limits< ctype >::max(), const ctype upper_y1=std::numeric_limits< ctype >::max()) |
| Replace the data, leaving host AND device current. The only mutator. | |
| NT | operator[] (size_t i) const |
| Host-side element access, in the row-major order update() takes its input in. | |
| device::array< typename Coordinates::ctype, 2 > KOKKOS_FUNCTION | index (const typename Coordinates::ctype s, const typename Coordinates::ctype x) const |
| Map physical coordinates onto grid indices. | |
| NT KOKKOS_FUNCTION | at (const device::array< typename Coordinates::ctype, 2 > &raw) const |
| Interpolate at grid indices previously obtained from index(). | |
| NT KOKKOS_FUNCTION | operator() (const typename Coordinates::ctype s, const typename Coordinates::ctype x) const |
| Interpolate the data at a given point. | |
| const Coordinates & | get_coordinates () const |
| Get the coordinate system of the data. | |
| const NT * | data () const |
| Read-only handle to the host values, in the mirror's storage order. | |
Static Public Attributes | |
| static constexpr size_t | dim = 2 |
Private Types | |
| using | ValueViewType = Kokkos::View<NT **, GPU_memory, Kokkos::MemoryTraits<Kokkos::RandomAccess>> |
| using | CoeffViewType = ValueViewType |
| using | HostValueViewType = typename ValueViewType::host_mirror_type |
| using | HostCoeffViewType = typename CoeffViewType::host_mirror_type |
Private Member Functions | |
| KOKKOS_FORCEINLINE_FUNCTION NT | value (const size_t i, const size_t j) const |
| Read one value from whichever buffer belongs to the executing side. | |
| KOKKOS_FORCEINLINE_FUNCTION NT | coeff (const size_t i, const size_t j) const |
| Read one spline coefficient from whichever buffer belongs to the executing side. | |
| void | build_y2 (const size_t sidx, const ctype lower_y1, const ctype upper_y1) |
Private Attributes | |
| const Coordinates | coordinates |
| const device::array< size_t, 2 > | sizes |
| ValueViewType | device_values |
| CoeffViewType | device_coeffs |
| HostValueViewType | host_values |
| HostCoeffViewType | host_coeffs |
Static Private Attributes | |
| static constexpr bool | has_separate_device |
Detailed Description
class DiFfRG::SplineInterpolator1DStack< NT, Coordinates >
A stack of 1D splines, callable from host AND device code.
Nearest-neighbour in the stack axis, spline in the data axis. See LinearInterpolator1D for the host/device dispatch rationale.
- Template Parameters
-
NT input data type Coordinates coordinate system of the input data
Member Typedef Documentation
◆ CoeffViewType
|
private |
◆ ctype
| using DiFfRG::SplineInterpolator1DStack< NT, Coordinates >::ctype = typename Coordinates::ctype |
◆ HostCoeffViewType
|
private |
◆ HostValueViewType
|
private |
◆ value_type
| using DiFfRG::SplineInterpolator1DStack< NT, Coordinates >::value_type = NT |
◆ ValueViewType
|
private |
Constructor & Destructor Documentation
◆ SplineInterpolator1DStack() [1/2]
|
inline |
Construct a SplineInterpolator1DStack with zeroed data and a coordinate system.
- Parameters
-
coordinates coordinate system of the data
◆ SplineInterpolator1DStack() [2/2]
|
default |
Shallow copy of ALL views, valid in host and in device code. See LinearInterpolator1D.
Member Function Documentation
◆ at()
|
inline |
Interpolate at grid indices previously obtained from index().
◆ build_y2()
|
inlineprivate |
◆ coeff()
|
inlineprivate |
Read one spline coefficient from whichever buffer belongs to the executing side.
◆ data()
|
inline |
Read-only handle to the host values, in the mirror's storage order.
NOTE the storage order is NOT the row-major order update() takes: the device view is pinned to GPU_memory, hence LayoutLeft. Use operator[] for row-major access.
◆ get_coordinates()
|
inline |
Get the coordinate system of the data.
- Returns
- const Coordinates& the coordinate system
◆ index()
|
inline |
Map physical coordinates onto grid indices.
Split out of operator() because it is the expensive half: Coordinates::backward is a fp64 log/log1p per logarithmic axis, ~200 fp64 instructions each on current NVIDIA parts against ~10 for the interpolation. A generated kernel evaluating several dressings at the SAME point otherwise pays it once per dressing – the compiler cannot CSE it, because each interpolator owns its own coordinates members and cannot be proven to agree with another's.
Depends only on the coordinate system, so the result may be shared across interpolators that share one. Clamping and stencil resolution stay in at(), since they are size dependent and would otherwise make an index untransferable between interpolators of different extent.
The return type is spelled out rather than deduced: nvcc loses decltype(var) when the initializer has a deduced return type inside a class-template member, and the consumer stores this in a const auto.
◆ operator()()
|
inline |
Interpolate the data at a given point.
◆ operator[]()
|
inline |
Host-side element access, in the row-major order update() takes its input in.
◆ update()
|
inline |
Replace the data, leaving host AND device current. The only mutator.
in_data is row-major; the fill indexes the mirror through operator(), which keeps that contract independent of the mirror's own layout. See LinearInterpolator1D::update() for why the host fill is a plain loop and why the single trailing fence is not optional.
◆ value()
|
inlineprivate |
Read one value from whichever buffer belongs to the executing side.
Member Data Documentation
◆ coordinates
|
private |
◆ device_coeffs
|
private |
◆ device_values
|
private |
◆ dim
|
staticconstexpr |
◆ has_separate_device
|
staticconstexprprivate |
◆ host_coeffs
|
private |
◆ host_values
|
private |
◆ sizes
|
private |
The documentation for this class was generated from the following file:
- /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/interpolation/spline_interpolator_1d_stack.hh
Generated by