Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
pmalloc.cpp File Reference
#include "gmxpre.h"
#include "pmalloc.h"
#include "gromacs/utility/smalloc.h"
+ Include dependency graph for pmalloc.cpp:

Description

Define functions for host-side memory handling when using OpenCL devices or no GPU device.

Author
Anca Hamuraru anca@.nosp@m.stre.nosp@m.amcom.nosp@m.puti.nosp@m.ng.eu

Functions

void pmalloc (void **h_ptr, size_t nbytes, const DeviceContext *)
 Allocates nbytes of host memory. Use pfree to free memory allocated with this function. More...
 
void pfree (void *h_ptr, const DeviceContext *)
 Frees memory allocated with pmalloc. More...
 
void pmallocSetDefaultDeviceContext (const DeviceContext *)
 
void pmallocClearDefaultDeviceContext ()
 

Function Documentation

void pfree ( void *  h_ptr,
const DeviceContext *   
)

Frees memory allocated with pmalloc.

Parameters
[in]h_ptrBuffer allocated with pmalloc that needs to be freed.
void pmalloc ( void **  h_ptr,
size_t  nbytes,
const DeviceContext *   
)

Allocates nbytes of host memory. Use pfree to free memory allocated with this function.

Todo:
This function should allocate page-locked memory to help reduce D2H and H2D transfer times, similar with pmalloc from pmalloc.cu.
Parameters
[in,out]h_ptrPointer where to store the address of the newly allocated buffer.
[in]nbytesSize in bytes of the buffer to be allocated.