Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
gpu_utils.cpp File Reference
#include "gmxpre.h"
#include "gpu_utils.h"
#include "config.h"
#include <cassert>
#include "gromacs/hardware/gpu_hw_info.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
+ Include dependency graph for gpu_utils.cpp:

Description

Function definitions for non-GPU builds.

Author
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Functions

bool canPerformGpuDetection ()
 Return whether GPUs can be detected. More...
 
int gpu_info_get_stat (const gmx_gpu_info_t &, int)
 Get status of device with specified index.
 
void free_gpu_info (const gmx_gpu_info_t *gpu_info)
 Frees the gpu_dev and dev_use array fields of gpu_info. More...
 
std::vector< int > getCompatibleGpus (const gmx_gpu_info_t &gpu_info)
 Return a container of the detected GPUs that are compatible. More...
 
const char * getGpuCompatibilityDescription (const gmx_gpu_info_t &gpu_info, int index)
 Return a string describing how compatible the GPU with given index is. More...
 
static bool addMessageIfNotSupported (gmx::ArrayRef< const std::string > errorReasons, std::string *error)
 Help build a descriptive message in error if there are errorReasons why nonbondeds on a GPU are not supported. More...
 
bool buildSupportsNonbondedOnGpu (std::string *error)
 Check if GROMACS has been built with GPU support. More...
 

Variables

static constexpr bool c_binarySupportsGpus = (GMX_GPU != GMX_GPU_NONE)
 Constant used to help minimize preprocessed code.
 

Function Documentation

static bool addMessageIfNotSupported ( gmx::ArrayRef< const std::string >  errorReasons,
std::string *  error 
)
static

Help build a descriptive message in error if there are errorReasons why nonbondeds on a GPU are not supported.

Returns
Whether the lack of errorReasons indicate there is support.
bool buildSupportsNonbondedOnGpu ( std::string *  error)

Check if GROMACS has been built with GPU support.

Parameters
[in]errorPointer to error string or nullptr.
Todo:
Move this to NB module once it exists.
bool canPerformGpuDetection ( )

Return whether GPUs can be detected.

Returns true when this is a build of GROMACS configured to support GPU usage, GPU detection is not disabled by an environment variable and a valid device driver, ICD, and/or runtime was detected. Does not throw.

void free_gpu_info ( const gmx_gpu_info_t gpu_info)

Frees the gpu_dev and dev_use array fields of gpu_info.

Parameters
[in]gpu_infopointer to structure holding GPU information
std::vector<int> getCompatibleGpus ( const gmx_gpu_info_t gpu_info)

Return a container of the detected GPUs that are compatible.

This function filters the result of the detection for compatible GPUs, based on the previously run compatibility tests.

Parameters
[in]gpu_infoInformation detected about GPUs, including compatibility.
Returns
vector of IDs of GPUs already recorded as compatible
const char* getGpuCompatibilityDescription ( const gmx_gpu_info_t gpu_info,
int  index 
)

Return a string describing how compatible the GPU with given index is.

Parameters
[in]gpu_infoInformation about detected GPUs
[in]indexindex of GPU to ask about
Returns
A null-terminated C string describing the compatibility status, useful for error messages.