Gromacs  2026.0-dev-20241121-c76fa1e
 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.

This function is a stub for CPU-only and OpenCL builds. CUDA, HIP, and SYCL have special implementations in separate files.

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.