CellGPU
0.8.0
GPU-accelerated simulations of cells
|
A class for handling data simultaneously on the CPU and GPU. More...
#include <gpuarray.h>
Public Member Functions | |
GPUArray (bool _register=false) | |
GPUArray (unsigned int num_elements, bool _register=false) | |
The most common constructor takes in the desired size of the array. | |
GPUArray (const GPUArray &from) | |
GPUArray & | operator= (const GPUArray &rhs) |
void | swap (GPUArray &from) |
Swap two GPUarrays efficiently. More... | |
unsigned int | getNumElements () const |
Get the size of the array. | |
void | setRegistered (bool _reg) |
Switch from simple memcpys to HostRegister pinned memory copies. Not currently fully functional. | |
virtual void | resize (unsigned int num_elements) |
Resize the array...performs operations on both the CPU and GPU. | |
Protected Member Functions | |
void | memclear (unsigned int first=0) |
T * | acquire (const access_location::Enum location, const access_mode::Enum mode) const |
void | release () const |
Protected Attributes | |
T * | h_data |
pointer to memory on host | |
Friends | |
class | ArrayHandle< T > |
A class for handling data simultaneously on the CPU and GPU.
This class and accessor are based on GPUArray.h, from the HOOMD-Blue simulation package. It is, however, simplified. It takes care of cuda memory copying for templated arrays. A flag (default to false) when declaring a GPUArray controls whether the memory is HostRegistered but only handles synchronous copy operatations (no Asynch, no HostRegister, etc.) It is also only for 1D arrays of data. Importantly, the user accesses and handles data through the ArrayHandle class.
Swap two GPUarrays efficiently.
a.swap(b) is: GPUArray c(a); a = b; b = c; It just swaps internal pointers
Referenced by Simulation::computeForces().
|
inlineprotected |
Acquire does all the work, keeping track of when data needs to be copied, etc. It is called by the ArrayHandle class