bnmf-algs
|
A wrapper template class around a row-major 3D tensor stored in main memory (host memory). More...
#include <host_memory_3d.hpp>
Public Types | |
using | value_type = T |
Type of the values stored in main memory. More... | |
Public Member Functions | |
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-major tensor. More... | |
cudaPitchedPtr | pitched_ptr () const |
Get the cudaPitchedPtr type storing allocation parameters and the pointer to the host memory. More... | |
cudaExtent | extent () const |
Get the cudaExtent type storing the extents of the allocation. More... | |
shape< 3 > | dims () const |
Get the dimensions of this memory region in terms of elements. More... | |
A wrapper template class around a row-major 3D tensor stored in main memory (host memory).
HostMemory3D class represents the memory of a row-major 3D tensor type stored in main memory (host memory). The intended use of this class is to provide an interface that can be used with CUDA functions.
HostMemory3D class does not own the memory it is given. Therefore, no allocation, copying or memory freeing is performed. The only use case of HostMemory3D is to provide a unified interface with DeviceMemory3D so that the two classes can be used interchangeably by cuda::copy3D function. See cuda::copy3D for details about copying 3D memory using CUDA functions from host/device to host/device memory.
If the pointer pointing to the memory is const, then the type of this class must be marked as const to prevent illegal mutating code from accessing the memory. For example,
T | Type of the values in the given memory address. |
using bnmf_algs::cuda::HostMemory3D< T >::value_type = T |
Type of the values stored in main memory.
|
inlineexplicit |
Construct a HostMemory3D class around the memory given by the pointer and the dimensions of a 3D row-major tensor.
The memory given by pointer is assumed to reside in main memory. Therefore, this function does not perform any memory allocation on main memory or GPU device.
data | Address of the beginning of the memory storing the row-major 3D tensor. |
first_dim | First dimension of the tensor. Since the given tensor memory is row-major, this is the dimension whose index changes the slowest when traversing the contiguous memory pointed by pointer parameter data. |
second_dim | Second dimension of the tensor. |
third_dim | Third dimension of the tensor. Since the given tensor memory is row-major, this is the dimension whose index changse the fastest when traversing the contiguous memory pointed by pointer parameter data. |
|
inline |
Get the dimensions of this memory region in terms of elements.
|
inline |
Get the cudaExtent type storing the extents of the allocation.
Parameters of the returned extent type is set according to a row-major tensor allocation. See cudaExtent type documentation for the parameters provided about the allocation.
|
inline |
Get the cudaPitchedPtr type storing allocation parameters and the pointer to the host memory.
Parameters of the returned pitched pointer type is set according to a row-major tensor allocation. See cudaPitchedPtr type documentation for the parameters provided about the allocation.