5 #include <cuda_runtime.h> 64 explicit HostMemory3D(T* data,
size_t first_dim,
size_t second_dim,
66 : m_dims(
shape<3>{first_dim, second_dim, third_dim}),
68 make_cudaExtent(third_dim *
sizeof(T), second_dim, first_dim)),
70 m_ptr.pitch = third_dim *
sizeof(T);
71 m_ptr.xsize = third_dim;
72 m_ptr.ysize = second_dim;
73 m_ptr.ptr = (
void*)(data);
98 cudaExtent
extent()
const {
return m_extent; }
123 cudaPitchedPtr m_ptr;
shape< 3 > dims() const
Get the dimensions of this memory region in terms of elements.
Definition: host_memory_3d.hpp:106
A wrapper template class around a row-major 3D tensor stored in main memory (host memory)...
Definition: host_memory_3d.hpp:37
cudaExtent extent() const
Get the cudaExtent type storing the extents of the allocation.
Definition: host_memory_3d.hpp:98
T value_type
Type of the values stored in main memory.
Definition: host_memory_3d.hpp:42
Eigen::array< size_t, N > shape
Shape of vectors, matrices, tensors, etc.
Definition: defs.hpp:66
cudaPitchedPtr pitched_ptr() const
Get the cudaPitchedPtr type storing allocation parameters and the pointer to the host memory...
Definition: host_memory_3d.hpp:87
Main namespace for bnmf-algs library.
Definition: alloc_model_funcs.hpp:12
HostMemory3D(T *data, size_t first_dim, size_t second_dim, size_t third_dim)
Construct a HostMemory3D class around the memory given by the pointer and the dimensions of a 3D row-...
Definition: host_memory_3d.hpp:64