Go to the documentation of this file.
    6 #ifndef OPENMPCD_CUDA_DEVICEMEMORYMANAGER_HPP 
    7 #define OPENMPCD_CUDA_DEVICEMEMORYMANAGER_HPP 
   62         template<
typename Po
intee> Pointee* 
allocateMemory(
const unsigned int instanceCount)
 
   64             return static_cast<Pointee*
>(allocateMemoryInternal(instanceCount * 
sizeof(Pointee)));
 
   91         template<
typename Po
intee> 
void allocateMemory(Pointee** pointerToPointer, 
const unsigned int instanceCount)
 
   94                 if(pointerToPointer == NULL)
 
   98             *pointerToPointer = allocateMemory<Pointee>(instanceCount);
 
  119         template<
typename Po
intee>
 
  124                 static_cast<Pointee*
>(
 
  125                     allocateMemoryInternalUnregistered(
 
  126                         instanceCount * 
sizeof(Pointee)));
 
  152         template<
typename Po
intee>
 
  155             Pointee** pointerToPointer, 
const unsigned int instanceCount)
 
  157             #ifdef OPENMPCD_DEBUG 
  158                 if(pointerToPointer == NULL)
 
  163                 allocateMemoryUnregistered<Pointee>(instanceCount);
 
  259                 const T* 
const src, T* 
const dest, 
const std::size_t count);
 
  283                 const T* 
const src, T* 
const dest, 
const std::size_t count);
 
  307                 const T* 
const src, T* 
const dest, 
const std::size_t count);
 
  327                 T* 
const start, 
const std::size_t numberOfElements);
 
  356                 const T* 
const host, 
const T* 
const device,
 
  357                 const std::size_t count);
 
  372         void* allocateMemoryInternal(
const std::size_t bufferSize);
 
  387         void* allocateMemoryInternalUnregistered(
const std::size_t bufferSize);
 
  396         std::set<const void*> allocatedBuffers; 
 
  
#define OPENMPCD_THROW(ExceptionType, message)
Throws the given ExceptionType, passing the given message along with file and line number information...
 
Class for managing memory on the CUDA Device.
 
static bool isDeviceMemoryPointer(const void *const ptr)
Returns whether the given pointer is a pointer to CUDA Device memory.
 
DeviceMemoryManager()
The constructor.
 
static void copyElementsFromHostToDevice(const T *const src, T *const dest, const std::size_t count)
Copies count elements of type T from the Host to the Device.
 
~DeviceMemoryManager()
The destructor.
 
static bool isHostMemoryPointer(const void *const ptr)
Returns whether the given pointer is a pointer to Host memory.
 
void setAutofree(const bool enable)
Sets, or unsets, the autofree flag.
 
static Pointee * allocateMemoryUnregistered(const unsigned int instanceCount)
Allocates Device memory for the given number of instances of the supplied type.
 
static void freeMemoryUnregistered(void *const pointer)
Frees the Device memory pointed to by the given pointer.
 
static void copyElementsFromDeviceToDevice(const T *const src, T *const dest, const std::size_t count)
Copies count elements of type T from the Device to the Device.
 
void freeMemory(void *const pointer)
Frees the Device memory pointed to by the given pointer.
 
static void zeroMemory(T *const start, const std::size_t numberOfElements)
Writes zero-bytes to the given Device memory region.
 
Pointee * allocateMemory(const unsigned int instanceCount)
Allocates Device memory for the given number of instances of the supplied type.
 
void allocateMemory(Pointee **pointerToPointer, const unsigned int instanceCount)
Allocates Device memory for the given number of instances of the supplied type.
 
static void allocateMemoryUnregistered(Pointee **pointerToPointer, const unsigned int instanceCount)
Allocates Device memory for the given number of instances of the supplied type.
 
static void copyElementsFromDeviceToHost(const T *const src, T *const dest, const std::size_t count)
Copies count elements of type T from the Device to the Host.
 
static bool elementMemoryEqualOnHostAndDevice(const T *const host, const T *const device, const std::size_t count)
Returns whether the count elements of type T at host in Host memory have the same byte-wise represent...