SyTen
syten::Cuda::CudaDynArray< Type > Class Template Reference

The CUDA-equivalent of DynArray. More...

#include <cuda_dynarray.h>

+ Inheritance diagram for syten::Cuda::CudaDynArray< Type >:
+ Collaboration diagram for syten::Cuda::CudaDynArray< Type >:

Public Types

using value_type = Type
 Typedef for the contained type. More...
 

Public Member Functions

MemoryUsage::MemorySize allocSize () const
 allocSize()/memory_size.h support. More...
 
CudaPtr< Type > begin ()
 Pointer to start of array. More...
 
CudaPtr< const Type > begin () const
 Pointer to start of const array. More...
 
CudaPtr< const Type > cbegin () const
 Pointer to start of const array. More...
 
CudaPtr< const Type > cend () const
 Pointer one past the end of const data. More...
 
CudaDynArray< Type > copy_to_device (int device) const
 Copies this onto the specified device or returns a const reference to this if CUDA is disabled. More...
 
 CudaDynArray ()=default
 Default ctor, empty array. More...
 
 CudaDynArray (CudaDynArray &&other)
 Move ctor. More...
 
 CudaDynArray (CudaDynArray const &other)
 Copy ctor. More...
 
 CudaDynArray (DynArray< Type > const &hm)
 Conversion ctor from a host-based DynArray of the same type. More...
 
 CudaDynArray (Size length_, int device_hint=-1)
 Standard ctor, takes the number of elements and potentially a device hint on which device this memory should be allocated. More...
 
CudaPtr< Type > end ()
 Pointer one past the end of data. More...
 
CudaPtr< const Type > end () const
 Pointer one past the end of const data. More...
 
int get_device () const
 Returns the device hosting data or -1 if either no device is used or data is the nullptr. More...
 
template<typename Archive >
void load (Archive &ar, const unsigned int in_version)
 Boost archiving. More...
 
 operator DynArray< Type > () const
 Conversion operator to a host-based DynArray of the same type. More...
 
CudaDynArrayoperator= (CudaDynArray &&other)
 Move assignment op. More...
 
CudaDynArrayoperator= (CudaDynArray const &other)
 Copy assignment op. More...
 
template<typename Archive >
void save (Archive &ar, const unsigned int) const
 Boost archiving. More...
 
Size size () const
 Number of contained elements. More...
 
 ~CudaDynArray ()
 Dtor, frees the memory. More...
 

Static Public Attributes

static constexpr unsigned int version = 2
 Boost serialisation version. More...
 

Private Member Functions

CudaPtr< Type > alloc ()
 Allocates enough memory to fit length objects and returns the pointer to this memory. More...
 
CudaPtr< Type > alloc_on_device (int device_hint)
 Allocates enough memory to fit length objects on the device device_hint and returns the pointer to this memory. More...
 

Private Attributes

CudaPtr< Type > data = nullptr
 Pointer to data, either on the device or host. More...
 
Size length = 0
 Length (in units of sizeof(Type) of the allocated memory. More...
 

Detailed Description

template<typename Type>
class syten::Cuda::CudaDynArray< Type >

The CUDA-equivalent of DynArray.

If CUDA support is compiled in, this array is backed by CUDA memory, otherwise it uses standard host memory (as provided by Cuda::alloc().


The documentation for this class was generated from the following file: