#include "config.h"
#include "gromacs/gpu_utils/devicebuffer_datatype.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/gpu_utils/devicebuffer.cuh"
Implements the logic for handling of DeviceBuffer types in OpenCL/CUDA. Can only be included on GPU build paths.
- Author
- Aleksei Iupinov a.yup.nosp@m.inov.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
template<typename ValueType >
void reallocateDeviceBuffer |
( |
DeviceBuffer< ValueType > * |
buffer, |
|
|
size_t |
numValues, |
|
|
int * |
currentNumValues, |
|
|
int * |
currentMaxNumValues, |
|
|
DeviceContext |
deviceContext |
|
) |
| |
Reallocates the device-side buffer.
Reallocates the device-side memory pointed by buffer
. Allocation is buffered and therefore freeing is only needed if the previously allocated space is not enough. currentNumValues
and currentMaxNumValues
are updated. TODO: currentNumValues
, currentMaxNumValues
, deviceContext
should all be encapsulated in a host-side class together with the buffer.
- Template Parameters
-
ValueType | Raw value type of the buffer . |
- Parameters
-
[in,out] | buffer | Pointer to the device-side buffer |
[in] | numValues | Number of values to accommodate. |
[in,out] | currentNumValues | The pointer to the buffer's number of values. |
[in,out] | currentMaxNumValues | The pointer to the buffer's capacity. |
[in] | deviceContext | The buffer's device context. |