46 template <
class T, rowsize _row_size, rowsize _row_max, rowsize _align>
49 :
public ArrayView<T, _row_size, _row_max, _align>
54 using typename t_base::RowView;
63 template <
class T, rowsize _row_size, rowsize _row_max, rowsize _align>
64 class ArrayDeviceView<
66 :
public ArrayView<T, _row_size, _row_max, _align>
69 using t_base = ArrayView<T, _row_size, _row_max, _align>;
71 using typename t_base::RowView;
74 DeviceBackend::CUDA, T, _row_size, _row_max, _align>;
76 static DeviceBackend backend() {
return DeviceBackend::CUDA; }
98 return static_cast<const T *
>(
const_cast<self_type *
>(
this)->
operator[](iRow));
106 template <DeviceBackend B,
class T, rowsize _row_size, rowsize _row_max, rowsize _align>
109 const index *n_rowstart,
index n_rowstart_size,
113 const index *n_rowstart_device,
114 const rowsize *n_rowsizes_device)
120 n_size, n_data, n_data_size,
121 n_rowstart, n_rowstart_size,
122 n_rowsizes, n_rowsizes_size,
126 else if constexpr (B == DeviceBackend::CUDA)
128 n_size, n_data_device, n_data_size,
129 n_rowstart_device, n_rowstart_size,
130 n_rowsizes_device, n_rowsizes_size,
136 n_size, n_data, n_data_size,
137 n_rowstart, n_rowstart_size,
138 n_rowsizes, n_rowsizes_size,
Array layout descriptors, non-owning views, row views, and iterator base.
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_DEVICE_CALLABLE
Device memory abstraction layer with backend-specific storage and factory creation.
Assertion / error-handling macros and supporting helper functions.
#define DNDS_assert_info(expr, info)
Debug-only assertion with an extra std::string info message.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
static DeviceBackend backend()
Non-owning device-callable view of an Array, specialised per DeviceBackend.
Non-owning, device-callable view onto an Array.
ArrayView< T, _row_size, _row_max, _align > self_type
T * operator[](index iRow)
Raw row pointer. iRow == Size() is allowed for past-the-end queries (useful for computing buffer end ...
DNDS_DEVICE_CALLABLE T * get_rowstart_pointer_compressed(index iRow)
T & operator()(index iRow, rowsize iCol=0)
2D indexed access (writable). See at.
DNDS_DEVICE_CALLABLE const T & at_compressed(index iRow, rowsize iCol) const
the host side operators are provided as implemented
DeviceBackend
Enumerates the backends a DeviceStorage / Array can live on.
@ Unknown
Unset / sentinel.
@ Custom1
Reserved slot for a project-specific backend.
auto ArrayDeviceView_build(index n_size, T *n_data, index n_data_size, const index *n_rowstart, index n_rowstart_size, const rowsize *n_rowsizes, index n_rowsizes_size, rowsize n_row_size_dynamic, T *n_data_device, const index *n_rowstart_device, const rowsize *n_rowsizes_device)
Factory for ArrayDeviceView: selects host or device pointers based on B and forwards everything else.
DNDS_CONSTANT const rowsize NoAlign
Alignment flag: no padding applied to rows (the only currently-supported value).
int32_t rowsize
Row-width / per-row element-count type (signed 32-bit).
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).