Gromacs  2022.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Enumerations | Functions
gpu_utils.h File Reference
#include <cstdio>
#include <string>
#include <vector>
#include "gromacs/gpu_utils/gpu_macros.h"
#include "gromacs/utility/basedefinitions.h"
+ Include dependency graph for gpu_utils.h:
+ This graph shows which files directly or indirectly include this file:

Description

Declare functions for detection and initialization for GPU devices.

Author
Szilard Pall pall..nosp@m.szil.nosp@m.ard@g.nosp@m.mail.nosp@m..com
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Enumerations

enum  GpuApiCallBehavior : int { GpuApiCallBehavior::Sync, GpuApiCallBehavior::Async, GpuApiCallBehavior::Count }
 Enum which is only used to describe transfer calls at the moment. More...
 
enum  GpuTaskCompletion { Wait, Check }
 Types of actions associated to waiting or checking the completion of GPU tasks.
 

Functions

const char * enumValueToString (GpuApiCallBehavior enumValue)
 String corresponding to GPU API call behavior.
 
void startGpuProfiler ()
 Starts the GPU profiler if mdrun is being profiled. More...
 
void resetGpuProfiler ()
 Resets the GPU profiler if mdrun is being profiled. More...
 
void stopGpuProfiler ()
 Stops the CUDA profiler if mdrun is being profiled. More...
 
bool isHostMemoryPinned (const void *h_ptr)
 Tells whether the host buffer was pinned for non-blocking transfers. Only implemented for CUDA.
 
void setupGpuDevicePeerAccess (const std::vector< int > &gpuIdsToUse, const gmx::MDLogger &mdlog)
 Enable peer access between GPUs where supported. More...
 
bool decideGpuTimingsUsage ()
 Check the platform-defaults and environment variable to decide whether GPU timings should be enabled. More...
 

Enumeration Type Documentation

enum GpuApiCallBehavior : int
strong

Enum which is only used to describe transfer calls at the moment.

Enumerator
Sync 

Synchronous.

Async 

Asynchronous.

Count 

Size of the enumeration.

Function Documentation

bool decideGpuTimingsUsage ( )

Check the platform-defaults and environment variable to decide whether GPU timings should be enabled.

Currently, timings are enabled for OpenCL, but disabled for CUDA and SYCL. This can be overridden by GMX_ENABLE_GPU_TIMING and GMX_DISABLE_GPU_TIMING environment variables.

void resetGpuProfiler ( )

Resets the GPU profiler if mdrun is being profiled.

When a profiler run is in progress (based on the presence of the NVPROF_ID env. var.), the profiler data is restet in order to eliminate the data collected from the preceding part fo the run.

This function should typically be called at the mdrun counter reset time.

Note that this is implemented only for the CUDA API.

void setupGpuDevicePeerAccess ( const std::vector< int > &  gpuIdsToUse,
const gmx::MDLogger mdlog 
)

Enable peer access between GPUs where supported.

Parameters
[in]gpuIdsToUseList of GPU IDs in use
[in]mdlogLogger object
void startGpuProfiler ( )

Starts the GPU profiler if mdrun is being profiled.

When a profiler run is in progress (based on the presence of the NVPROF_ID env. var.), the profiler is started to begin collecting data during the rest of the run (or until stopGpuProfiler is called).

Note that this is implemented only for the CUDA API.

void stopGpuProfiler ( )

Stops the CUDA profiler if mdrun is being profiled.

This function can be called at cleanup when skipping recording recording subsequent API calls from being traces/profiled is desired, e.g. before uninitialization.

Note that this is implemented only for the CUDA API.