Gromacs  2019-beta1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
devicebuffer.h File Reference
#include "config.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/gpu_utils/devicebuffer.cuh"
+ Include dependency graph for devicebuffer.h:


Implements the logic for handling of DeviceBuffer types in OpenCL/CUDA. Can only be included on GPU build paths.

Aleksei Iupinov


template<typename ValueType >
void reallocateDeviceBuffer (DeviceBuffer< ValueType > *buffer, size_t numValues, int *currentNumValues, int *currentMaxNumValues, Context context)
 Reallocates the device-side buffer. More...

Function Documentation

template<typename ValueType >
void reallocateDeviceBuffer ( DeviceBuffer< ValueType > *  buffer,
size_t  numValues,
int *  currentNumValues,
int *  currentMaxNumValues,
Context  context 

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, context should all be encapsulated in a host-side class together with the buffer.

Template Parameters
ValueTypeRaw value type of the buffer.
[in,out]bufferPointer to the device-side buffer
[in]numValuesNumber of values to accomodate.
[in,out]currentNumValuesThe pointer to the buffer's number of values.
[in,out]currentMaxNumValuesThe pointer to the buffer's capacity.
[in]contextThe buffer's context.