Implementation for syten::CudaPtr. More...
#include <cuda_support.h>
Public Member Functions | |
CudaPtr< char > | c () const |
If the pointer is non-const, this returns a char pointer to the allocation. More... | |
template<typename U > | |
CudaPtr< U > | cast () const |
Returns a pointer of type U without type checking. More... | |
CudaPtr< const char > | cc () const |
Returns a const char pointer to the allocation. More... | |
CudaPtr () | |
Default ctor. More... | |
CudaPtr (const void *vptr, std::int16_t host_device_, std::int16_t size_index_) | |
Standard ctor. More... | |
CudaPtr (CudaPtr const &)=default | |
Standard copy ctor. More... | |
template<typename U , typename std::enable_if_t< std::is_same_v< std::remove_const_t< U >, std::remove_const_t< T > >, int > = 0> | |
CudaPtr (CudaPtr< U > p) | |
Converting ctor from a non-const to a const region. More... | |
CudaPtr (std::nullptr_t) | |
Default ctor. More... | |
CudaPtr (void *vptr, std::int16_t host_device_, std::int16_t size_index_) | |
Standard ctor. More... | |
CudaPtr< const void > | cv () const |
Returns a const void pointer to the allocation. More... | |
std::int16_t | dev () const |
Returns the device of the allocation. More... | |
T * | get () const |
Returns the pointer to the allocation. More... | |
bool | is_freeable () const |
Returns the freeability of the allocation. More... | |
bool | operator!= (CudaPtr< T > const &other) const |
Unequal operator. More... | |
CudaPtr | operator+ (std::size_t num) const |
Pointer arithmetic. More... | |
CudaPtr & | operator++ () |
Increment operator. More... | |
CudaPtr & | operator= (CudaPtr const &)=default |
Standard copy assignment op. More... | |
bool | operator== (CudaPtr< T > const &other) const |
Comparison operator. More... | |
std::int16_t | size_idx () const |
Returns the size exponent of the allocation. More... | |
CudaPtr< void > | v () const |
If the pointer is non-const, this returns a void pointer to the allocation. More... | |
Private Attributes | |
std::int16_t | host_device |
device on which the allocation occured. More... | |
T * | ptr |
ptr to the allocation. More... | |
std::int16_t | size_index |
allocation is using size class at index size_index. More... | |
Implementation for syten::CudaPtr.
This struct does not own its allocation but merely remembers on which device it took place and in which allocation bucket.
To free the allocation, you need to pass in the original allocation pointer.