asrl::CudaSynchronizedMemory< T > Class Template Referencea class that handles synchronization of memory between the host and device More...
Detailed Descriptiontemplate<typename T>
|
typedef T asrl::CudaSynchronizedMemory< T >::value_type |
The underlying type of the allocated memory.
Definition at line 75 of file CudaSynchronizedMemory.hpp.
asrl::CudaSynchronizedMemory< T >::CudaSynchronizedMemory | ( | CudaSynchronizedMemory< T > const & | rhs | ) | [private] |
The object is non-copyable as we need to be careful about memory leaks.
asrl::CudaSynchronizedMemory< T >::CudaSynchronizedMemory | ( | ) | [inline] |
A constructor that initializes both the host and device pointers with null values
Definition at line 247 of file CudaSynchronizedMemory.hpp.
asrl::CudaSynchronizedMemory< T >::CudaSynchronizedMemory | ( | unsigned | N, | |
bool | pageLocked = false | |||
) | [inline] |
A constructor that allocates memory for N elements of type T on both the host and the device.
N | The number of elements to allocate | |
pageLocked | Should the host memory be page-locked |
Definition at line 250 of file CudaSynchronizedMemory.hpp.
asrl::CudaSynchronizedMemory< T >::~CudaSynchronizedMemory | ( | ) | [inline] |
A destructor to clean up the allocated memory
Definition at line 256 of file CudaSynchronizedMemory.hpp.
T * asrl::CudaSynchronizedMemory< T >::begin | ( | ) | [inline] |
Definition at line 379 of file CudaSynchronizedMemory.hpp.
T const * asrl::CudaSynchronizedMemory< T >::d_get | ( | ) | const [inline] |
Definition at line 402 of file CudaSynchronizedMemory.hpp.
T * asrl::CudaSynchronizedMemory< T >::d_get | ( | ) | [inline] |
Definition at line 399 of file CudaSynchronizedMemory.hpp.
T * asrl::CudaSynchronizedMemory< T >::end | ( | ) | [inline] |
Definition at line 386 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::freeDeviceMemory | ( | ) | [inline, private] |
Definition at line 299 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::freeHostMemory | ( | ) | [inline, private] |
Definition at line 279 of file CudaSynchronizedMemory.hpp.
T const * asrl::CudaSynchronizedMemory< T >::h_get | ( | ) | const [inline] |
Definition at line 396 of file CudaSynchronizedMemory.hpp.
T * asrl::CudaSynchronizedMemory< T >::h_get | ( | ) | [inline] |
Definition at line 393 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::init | ( | unsigned | N, | |
bool | pageLocked = false | |||
) | [inline] |
A function that allocates memory for N elements of type T on both the host and the device.
N | The number of elements to allocate | |
pageLocked | Should the host memory be page-locked |
Definition at line 339 of file CudaSynchronizedMemory.hpp.
bool asrl::CudaSynchronizedMemory< T >::isPageLocked | ( | ) | [inline] |
Definition at line 373 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::memset | ( | int | val | ) | [inline] |
Calls memset on both the host and device memory.
Definition at line 315 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::memsetDevice | ( | int | val | ) | [inline] |
calls cudaMemset() on the device memory.
Definition at line 330 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::memsetHost | ( | int | val | ) | [inline] |
calls memset() on the host memory.
Definition at line 323 of file CudaSynchronizedMemory.hpp.
CudaSynchronizedMemory& asrl::CudaSynchronizedMemory< T >::operator= | ( | CudaSynchronizedMemory< T > const & | rhs | ) | [private] |
The object is non-copyable as we need to be careful about memory leaks.
T const & asrl::CudaSynchronizedMemory< T >::operator[] | ( | size_t | i | ) | const [inline] |
An convenience operator that dereferences the host array
i | the index to dereference the host array |
Definition at line 415 of file CudaSynchronizedMemory.hpp.
T & asrl::CudaSynchronizedMemory< T >::operator[] | ( | size_t | i | ) | [inline] |
An convenience operator that dereferences the host array
i | the index to dereference the host array |
Definition at line 408 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::pullFromDevice | ( | size_t | nElements = std::numeric_limits<size_t>::max() |
) | [inline] |
Pulls bytes from the device to the host.
nElements | The number of elements of the array to pull. If this is greater than size() or -1, all allocated elements are pulled from the device. |
Definition at line 433 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::pullFromDeviceAsync | ( | cudaStream_t | stream, | |
size_t | nElements = std::numeric_limits<size_t>::max() | |||
) | [inline] |
Initiate an asynchronous transfer from the host to the device.
stream | The cuda stream associated with the transfer. | |
nElements | The number of elements to pull. If this is greater than size() or -1, all allocated elements are pulled from the device. |
Definition at line 443 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::pushToDevice | ( | size_t | nElements = std::numeric_limits<size_t>::max() |
) | [inline] |
Pushes bytes from the host to the device.
nElements | The number of elements to push. If this is greater than size() or -1, all allocated elements are pushed to the device. |
Definition at line 422 of file CudaSynchronizedMemory.hpp.
void asrl::CudaSynchronizedMemory< T >::reset | ( | ) | [inline] |
Clear both the host and device memory.
Definition at line 269 of file CudaSynchronizedMemory.hpp.
size_t asrl::CudaSynchronizedMemory< T >::size | ( | ) | const [inline] |
Definition at line 405 of file CudaSynchronizedMemory.hpp.
T* asrl::CudaSynchronizedMemory< T >::m_device [private] |
A reference-counted pointer to the device memory.
Definition at line 237 of file CudaSynchronizedMemory.hpp.
T* asrl::CudaSynchronizedMemory< T >::m_host [private] |
A reference-counted pointer to the host memory.
Definition at line 235 of file CudaSynchronizedMemory.hpp.
bool asrl::CudaSynchronizedMemory< T >::m_pageLocked [private] |
Is the host memory page-locked.
Definition at line 241 of file CudaSynchronizedMemory.hpp.
size_t asrl::CudaSynchronizedMemory< T >::m_size [private] |
The number of elements of type T allocated.
Definition at line 239 of file CudaSynchronizedMemory.hpp.