Open Qmin
0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
|
A class for handling data simultaneously on the CPU and GPU. More...
#include <gpuarray.h>
Public Member Functions | |
GPUArray (bool neverGPU=false, bool _register=false) | |
GPUArray (unsigned int num_elements, bool neverGPU=false, bool _register=false) | |
The most common constructor takes in the desired size of the array. More... | |
virtual | ~GPUArray () |
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. More... | |
void | setRegistered (bool _reg) |
Switch from simple memcpys to HostRegister pinned memory copies. Not currently fully functional. More... | |
virtual void | resize (unsigned int num_elements) |
Resize the array...performs operations on both the CPU and GPU. More... | |
Public Attributes | |
data_location::Enum | Data_location |
Tracks the current location of the data. More... | |
bool | noGPU |
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 * | d_data |
pointer to memory on device More... | |
T * | h_data |
pointer to memory on host More... | |
Private Member Functions | |
void | allocate () |
void | deallocate () |
void | memcpyDeviceToHost () const |
void | memcpyHostToDevice () const |
T * | resizeHostArray (unsigned int num_elements) |
T * | resizeDeviceArray (unsigned int num_elements) |
Private Attributes | |
unsigned int | Num_elements |
Number of elements. More... | |
bool | Acquired |
Tracks whether the data has been acquired. More... | |
bool | RegisterArray |
Tracks whether the data has been acquired. More... | |
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.
GPUArray< T >::GPUArray | ( | unsigned int | num_elements, |
bool | neverGPU = false , |
||
bool | _register = false |
||
) |
The most common constructor takes in the desired size of the array.
Swap two GPUarrays efficiently.
a.swap(b) is: GPUArray c(a); a = b; b = c; It just swaps internal pointers
|
inline |
Get the size of the array.
Referenced by hyperrectangularCellList::computeAdjacentCells(), neighborList::computeCPU(), hyperrectangularCellList::computeCPU(), landauDeGennesLC::computeFirstDerivatives(), neighborList::computeGPU(), hyperrectangularCellList::computeGPU(), landauDeGennesLC::computeObjectForces(), landauDeGennesLC::computeStressTensors(), cubicLattice::createBoundaryObject(), equationOfMotion::getClassSize(), multirankQTensorLatticeModel::getClassSize(), energyMinimizerGradientDescent::getClassSize(), energyMinimizerLoLBFGS::getClassSize(), energyMinimizerFIRE::getClassSize(), force::getClassSize(), cubicLattice::getClassSize(), landauDeGennesLC::getClassSize(), simpleModel::getClassSize(), gpu_copy_gpuarray(), gpu_gpuarray_dVec_dot_products(), noiseSource::initializeGPURNGs(), hyperrectangularCellList::resetCellSizes(), hyperrectangularCellList::resetCellSizesCPU(), neighborList::resetNeighborsCPU(), neighborList::resetNeighborsGPU(), and simpleModel::setParticlePositions().
|
inline |
Switch from simple memcpys to HostRegister pinned memory copies. Not currently fully functional.
|
virtual |
Resize the array...performs operations on both the CPU and GPU.
Referenced by hyperrectangularCellList::computeAdjacentCells(), landauDeGennesLC::computeFirstDerivatives(), landauDeGennesLC::computeObjectForces(), landauDeGennesLC::computeStressTensors(), cubicLattice::createBoundaryObject(), multirankQTensorLatticeModel::determineBufferLayout(), cubicLattice::fillNeighborLists(), gpu_copy_gpuarray(), gpu_gpuarray_dVec_dot_products(), noiseSource::initialize(), energyMinimizerAdam::initializeFromModel(), energyMinimizerNesterovAG::initializeFromModel(), energyMinimizerLoLBFGS::initializeFromModel(), equationOfMotion::initializeFromModel(), energyMinimizerGradientDescent::initializeFromModel(), energyMinimizerFIRE::initializeFromModel(), noiseSource::initializeGPURNGs(), energyMinimizerNesterovAG::initializeParameters(), energyMinimizerLoLBFGS::initializeParameters(), simpleModel::initializeSimpleModel(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), qTensorLatticeModel::qTensorLatticeModel(), hyperrectangularCellList::resetCellSizes(), hyperrectangularCellList::resetCellSizesCPU(), neighborList::resetNeighborsCPU(), neighborList::resetNeighborsGPU(), hyperrectangularCellList::setGridSize(), energyMinimizerLoLBFGS::setLoLBFGSParameters(), and landauDeGennesLC::setModel().
|
inlineprotected |
Referenced by GPUArray< curandState >::GPUArray().
|
inlineprotected |
Acquire does all the work, keeping track of when data needs to be copied, etc. It is called by the ArrayHandle class
|
inlineprotected |
|
inlineprivate |
Referenced by GPUArray< curandState >::GPUArray().
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
friend |
|
mutable |
Tracks the current location of the data.
Referenced by GPUArray< curandState >::swap().
bool GPUArray< T >::noGPU |
Referenced by cubicLattice::createBoundaryObject(), equationOfMotion::initializeFromModel(), energyMinimizerGradientDescent::initializeFromModel(), energyMinimizerFIRE::initializeFromModel(), cubicLattice::initializeNSites(), simpleModel::initializeSimpleModel(), landauDeGennesLC::landauDeGennesLC(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), and qTensorLatticeModel::qTensorLatticeModel().
|
mutableprivate |
Number of elements.
Referenced by GPUArray< curandState >::getNumElements(), GPUArray< curandState >::GPUArray(), GPUArray< curandState >::operator=(), GPUArray< curandState >::setRegistered(), and GPUArray< curandState >::swap().
|
mutableprivate |
Tracks whether the data has been acquired.
Referenced by GPUArray< curandState >::release(), and GPUArray< curandState >::swap().
|
private |
Tracks whether the data has been acquired.
Referenced by GPUArray< curandState >::operator=(), GPUArray< curandState >::setRegistered(), and GPUArray< curandState >::swap().
|
mutableprotected |
pointer to memory on device
Referenced by GPUArray< curandState >::swap().
|
mutableprotected |
pointer to memory on host
Referenced by GPUArray< curandState >::GPUArray(), GPUArray< curandState >::setRegistered(), and GPUArray< curandState >::swap().