Definition at line 58 of file CudaMemory.cuh.
Public Member Functions | |
bool | copyDeviceToDevice (const CudaMemory &m) |
copy from GPU to GPU buffer directly | |
virtual bool | flush () |
flush the memory | |
virtual bool | allocate (size_t sz) |
allocate memory | |
virtual void | destroy () |
destroy memory | |
virtual bool | copy (const memory &m) |
copy from a General device | |
virtual size_t | size () const |
the the size of the allocated memory | |
virtual bool | resize (size_t sz) |
resize the momory allocated | |
virtual void * | getPointer () |
get a readable pointer with the data | |
virtual const void * | getPointer () const |
get a readable pointer with the data | |
virtual void * | getDevicePointer () |
get a readable pointer with the data | |
virtual void | hostToDevice () |
Move memory from host to device. | |
virtual void | deviceToHost () |
Move memory from device to host. | |
virtual void | deviceToHost (size_t start, size_t stop) |
Move memory from device to host, just the selected chunk. | |
virtual void | hostToDevice (size_t start, size_t top) |
Move memory from host to device, just the selected chunk. | |
void | hostToDevice (CudaMemory &mem) |
host to device using external memory (this host memory is copied into mem device memory) | |
void | deviceToHost (CudaMemory &mem) |
device to host using external memory (this device memory is copied into mem host memory) | |
virtual void | fill (unsigned char c) |
fill the buffer with a byte | |
void | isNotSync () |
virtual void | incRef () |
Increment the reference counter. | |
virtual void | decRef () |
Decrement the reference counter. | |
virtual long int | ref () |
Return the reference counter. | |
bool | isInitialized () |
Allocated Memory is never initialized. | |
CudaMemory & | operator= (const CudaMemory &mem) |
CudaMemory (const CudaMemory &mem) | |
CudaMemory (CudaMemory &&mem) EXCEPT_MC | |
CudaMemory () | |
Constructor. | |
CudaMemory (size_t sz) | |
Constructor. | |
~CudaMemory () | |
Destructor. | |
void | deviceToDevice (void *ptr, size_t start, size_t stop, size_t offset) |
copy memory from device to device | |
void | swap (CudaMemory &mem) |
Swap the memory. | |
void * | toKernel () |
return the device memory | |
Public Member Functions inherited from memory | |
virtual | ~memory () |
destructor | |
Static Public Member Functions | |
static constexpr bool | isDeviceHostSame () |
Return true if the device and the host pointer are the same. | |
Private Member Functions | |
void | allocate_host (size_t sz) const |
Allocate an host buffer. | |
bool | copyFromPointer (const void *ptr) |
copy from Pointer to GPU | |
Private Attributes | |
bool | is_hm_sync |
Is the host memory synchronized with the GPU memory. | |
size_t | sz |
Size of the memory. | |
void * | dm |
device memory | |
void * | hm |
host memory | |
size_t | ref_cnt |
Reference counter. | |
|
inline |
Definition at line 169 of file CudaMemory.cuh.
|
inline |
Definition at line 176 of file CudaMemory.cuh.
|
inline |
Constructor.
Definition at line 193 of file CudaMemory.cuh.
|
inline |
Constructor.
Definition at line 196 of file CudaMemory.cuh.
|
inline |
Destructor.
Definition at line 202 of file CudaMemory.cuh.
|
virtual |
allocate memory
Allocate a chunk of memory.
Allocate a chunk of memory
sz | size of the chunk of memory to allocate in byte |
Allocate the device memory
Implements memory.
Definition at line 38 of file CudaMemory.cu.
|
private |
Allocate an host buffer.
Allocate the host buffer.
Allocate the host buffer
Definition at line 133 of file CudaMemory.cu.
|
virtual |
copy from a General device
copy from memory
copy from memory
m | a memory interface |
Here we try to cast memory into OpenFPMwdeviceCudaMemory
if we fail we get the pointer and simply copy from the pointer
Implements memory.
Definition at line 216 of file CudaMemory.cu.
bool CudaMemory::copyDeviceToDevice | ( | const CudaMemory & | m | ) |
copy from GPU to GPU buffer directly
copy from device to device
copy a piece of memory from device to device
CudaMemory | from where to copy |
The source buffer is too big to copy it
Copy the memory
Definition at line 187 of file CudaMemory.cu.
|
private |
copy from Pointer to GPU
copy the data from a pointer
copy the data from a pointer
ptr |
Definition at line 157 of file CudaMemory.cu.
|
inlinevirtual |
|
virtual |
destroy memory
destroy a chunk of memory
Destroy a chunk of memory
Release the allocated memory
we invalidate hm
Implements memory.
Definition at line 80 of file CudaMemory.cu.
void CudaMemory::deviceToDevice | ( | void * | ptr, |
size_t | start, | ||
size_t | stop, | ||
size_t | offset | ||
) |
copy memory from device to device
external | device pointer |
start | source starting point (where it start to copy) |
stop | end point |
offset | where to copy in the device pointer |
external | device pointer |
start | source starting point (where it start to copy) |
stop | end point |
offset | where to copy in the device pointer |
Definition at line 119 of file CudaMemory.cu.
|
virtual |
Move memory from device to host.
Return a readable pointer with your data.
copy from device to host memory
Implements memory.
Definition at line 369 of file CudaMemory.cu.
void CudaMemory::deviceToHost | ( | CudaMemory & | mem | ) |
device to host using external memory (this device memory is copied into mem host memory)
It transfer to device memory from the host of another memory.
mem | the other memory object |
copy from device to host memory
Definition at line 388 of file CudaMemory.cu.
|
virtual |
Move memory from device to host, just the selected chunk.
Return a readable pointer with your data.
copy from device to host memory
Implements memory.
Definition at line 450 of file CudaMemory.cu.
|
virtual |
fill the buffer with a byte
fill host and device memory with the selected byte
Implements memory.
Definition at line 485 of file CudaMemory.cu.
|
virtual |
flush the memory
Move the memory into device.
copy from host to device memory
Implements memory.
Definition at line 15 of file CudaMemory.cu.
|
virtual |
get a readable pointer with the data
Return the CUDA device pointer.
Implements memory.
Definition at line 503 of file CudaMemory.cu.
|
virtual |
get a readable pointer with the data
Return a readable pointer with your data.
Implements memory.
Definition at line 354 of file CudaMemory.cu.
|
virtual |
get a readable pointer with the data
Return a readable pointer with your data.
Implements memory.
Definition at line 472 of file CudaMemory.cu.
|
virtual |
Move memory from host to device.
Return a readable pointer with your data.
copy from device to host memory
Implements memory.
Definition at line 514 of file CudaMemory.cu.
void CudaMemory::hostToDevice | ( | CudaMemory & | mem | ) |
host to device using external memory (this host memory is copied into mem device memory)
It transfer to device memory from the host of another memory.
mem | the other memory object |
copy from device to host memory
Definition at line 414 of file CudaMemory.cu.
|
virtual |
Move memory from host to device, just the selected chunk.
copy from device to host memory
Implements memory.
Definition at line 431 of file CudaMemory.cu.
|
inlinevirtual |
|
inlinestaticconstexpr |
Return true if the device and the host pointer are the same.
Definition at line 227 of file CudaMemory.cuh.
|
inlinevirtual |
Allocated Memory is never initialized.
Implements memory.
Definition at line 156 of file CudaMemory.cuh.
|
inline |
This function notify that the device memory is not sync with the host memory, is called when a task is performed that write on the buffer
Definition at line 131 of file CudaMemory.cuh.
|
inline |
Definition at line 162 of file CudaMemory.cuh.
|
inlinevirtual |
|
virtual |
resize the momory allocated
Resize the allocated memory.
Resize the allocated memory, if request is smaller than the allocated memory is not resized
sz | size |
Allocate the device memory if not done yet
Create a new buffer, if sz is bigger than the actual size
Create a new buffer, if sz is bigger than the actual size
copy from the old buffer to the new one
copy from the old buffer to the new one
free the old buffer
change to the new buffer
Implements memory.
Definition at line 261 of file CudaMemory.cu.
|
virtual |
the the size of the allocated memory
Get the size of the allocated memory.
Get the size of the allocated memory
Implements memory.
Definition at line 245 of file CudaMemory.cu.
void CudaMemory::swap | ( | CudaMemory & | mem | ) |
|
inline |
return the device memory
Definition at line 237 of file CudaMemory.cuh.
|
private |
device memory
Definition at line 67 of file CudaMemory.cuh.
|
mutableprivate |
host memory
Definition at line 70 of file CudaMemory.cuh.
|
private |
Is the host memory synchronized with the GPU memory.
Definition at line 61 of file CudaMemory.cuh.
|
private |
Reference counter.
Definition at line 73 of file CudaMemory.cuh.
|
private |
Size of the memory.
Definition at line 64 of file CudaMemory.cuh.