Gromacs  2021.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
oclutils.cpp File Reference
#include "gmxpre.h"
#include "oclutils.h"
#include <stdlib.h>
#include <cassert>
#include <cstdio>
#include <string>
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
+ Include dependency graph for oclutils.cpp:

Description

Define utility routines for OpenCL.

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)
 Allocates nbytes of host memory. Use ocl_free to free memory allocated with this function. More...
 
void pfree (void *h_ptr)
 Frees memory allocated with pmalloc. More...
 
std::string ocl_get_error_string (cl_int error)
 Convert error code to diagnostic string.
 

Function Documentation

void pfree ( void *  h_ptr)

Frees memory allocated with pmalloc.

Free host memory in malloc style.

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

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

Allocate host memory in malloc style.

Todo:
This function should allocate page-locked memory to help reduce D2H and H2D transfer times, similar with pmalloc from pmalloc_cuda.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.