An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from either the GPU or the CPU. In unified mode, the two data are one insofar as the programmer sees it, and the page migration engine engaged by cudaMallocManaged handles the two physical memory spaces at a very low level. In other modes, composite memory must be uploaded or downloaded explicitly in order to maintain synchrony between host and device memory spaces. This struct mimics a lot of the most noteworthy behavior of std::vector, but with the potential to behave as a pointer as well. In this manner, it is intended to confer the convenience of C++ with the freedom of classic C programming.
More...
|
| Hybrid (const Hybrid &original) |
| Copy constructor handles the reassignment of the underlying raw pointers.
|
|
| Hybrid (Hybrid &&original) |
| The move constructor handles migration of a Hybrid object.
|
|
| ~Hybrid () |
| Destructor frees data with no re-allocation.
|
|
Hybrid & | operator= (const Hybrid &other) |
| Copy assignment constructor handles the reassignment of the underlying raw pointers.
|
|
Hybrid & | operator= (Hybrid &&other) |
| The move assignment operator must likewise handle transfer of the underlying data.
|
|
HybridKind | getKind () const |
| Get the object kind (pointer or array)
|
|
HybridFormat | getFormat () const |
| Get the memory format.
|
|
size_t | size () const |
| Return the number of elements in the Hybrid object's data array(s)
|
|
size_t | capacity () const |
| Return the number of elements in the Hybrid object's data array(s)
|
|
size_t | getPointerIndex () const |
| Return the pointer start position, targeting another ARRAY-kind Hybrid object (relevant for POINTER-kind Hybrid objects only)
|
|
size_t | getElementSize () const |
| Return the size of an individual element in the data array(s)
|
|
HybridLabel | getLabel () const |
| Return the object's identifying label.
|
|
int | getSerialNumber () const |
| Return the object's identifying serial number.
|
|
int | getAllocations () const |
| Return the number of times this object has been allocated.
|
|
int | getTargetSerialNumber () const |
| Produce the serial number of the target (only valid for POINTER-kind objects). This function is needed for the copy constructor in the POINTER-kind case.
|
|
bool | verifyTarget () const |
| Verify that the target of a HybridKind::POINTER object remains in the state it was in when the pointer was first set.
|
|
void | shrinkToFit () |
| Trim a Hybrid array to the exact size of its data.
|
|
void | setPointer (Hybrid< T > *target, size_t position=0, llint new_length=-1LL) |
| Set a Hybrid pointer struct to a segment of a Hybrid array struct.
|
|
void | swapTarget (Hybrid< T > *new_target, ExceptionResponse policy=ExceptionResponse::SILENT) |
| Swap the target of a POINTER-kind Hybrid object, transferring its starting index and current length to apply instead to the new target. Bounds checks will still be applied. Not valid for ARRAY-kind Hybrid objects or for POINTER-kind objects that have no current target.
|
|
|
| Hybrid (size_t length_in=0, const char *tag_in=nullptr, const HybridFormat format_in=default_hpc_format, const HybridKind kind_in=HybridKind::ARRAY) |
| Constructors vary based on whether CUDA is part of the compilation.
|
|
| Hybrid (const std::vector< T > &S_in, const char *tag_in=nullptr, const HybridFormat format_in=default_hpc_format) |
|
| Hybrid (const HybridKind kind_in, const char *tag_in=nullptr, const HybridFormat format_in=default_hpc_format, size_t length_in=0) |
|
|
const T * | data (const HybridTargetLevel tier=HybridTargetLevel::HOST) const |
| Get a pointer directly to the GpuArray's data on either the host or the device.
|
|
T * | data (const HybridTargetLevel tier=HybridTargetLevel::HOST) |
|
|
T | readHost (size_t index) const |
| Get data from a given index of the host_data array. This substitutes for direct array access via the [ ] operator, as the host_data and devc_data pointers are private.
|
|
std::vector< T > | readHost (size_t offset, size_t count) const |
|
std::vector< T > | readHost () const |
|
void | readHost (T *v, size_t offset, size_t count) const |
|
|
void | putHost (const T value, size_t index) |
| Put data into the host_data array. This substitutes for direct array access via the [ ] operator, as the host_data and devc_data pointers are private.
|
|
void | putHost (const std::vector< T > &values, size_t offset, size_t count) |
|
void | putHost (const std::vector< T > &values) |
|
size_t | putHost (Hybrid< T > *target, const std::vector< T > &values, size_t offset=0, size_t padding=0, size_t count=0) |
|
|
void | pushBack (const T element) |
| Mimic the C++ std::vector push_back functionality. A bounds check is followed by extension of the data arrays in the current format if necessary. The new element is placed at the end of the host_data array. The Hybrid object must be ARRAY-kind or a POINTER-kind with sufficient maximum capacity (no reallocation needed). Additions will go to the CPU host memory.
|
|
void | pushBack (const T *elements, const size_t element_count) |
|
void | pushBack (const std::vector< T > &elements) |
|
void | pushBack (const Hybrid< T > &elements) |
|
|
void | resize (size_t new_length) |
| A std::vector-like resize() feature.
|
|
void | resize (size_t new_length, T value) |
|
|
const Hybrid< T > | getPointer (size_t position=0, size_t new_length=0, const char *tag_in=nullptr) const |
| Get a pointer to a Hybrid object at a specific location. This is the way to get const Hybrid POINTER-kind objects to const ARRAY-kind Hybrid objects. This function is only available to ARRAY-kind Hybrid objects.
|
|
Hybrid< T > | getPointer (size_t position=0, size_t new_length=0, const char *tag_in=nullptr) |
|
template<typename T>
class stormm::trajectory::Hybrid< T >
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from either the GPU or the CPU. In unified mode, the two data are one insofar as the programmer sees it, and the page migration engine engaged by cudaMallocManaged handles the two physical memory spaces at a very low level. In other modes, composite memory must be uploaded or downloaded explicitly in order to maintain synchrony between host and device memory spaces. This struct mimics a lot of the most noteworthy behavior of std::vector, but with the potential to behave as a pointer as well. In this manner, it is intended to confer the convenience of C++ with the freedom of classic C programming.