Gromacs  2018.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
gpu_utils_ocl.cpp File Reference
#include "gmxpre.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/gpu_utils/ocl_compiler.h"
#include "gromacs/gpu_utils/oclutils.h"
#include "gromacs/hardware/hw_info.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
+ Include dependency graph for gpu_utils_ocl.cpp:

Description

Define functions for detection and initialization for OpenCL devices.

Author
Anca Hamuraru anca@.nosp@m.stre.nosp@m.amcom.nosp@m.puti.nosp@m.ng.eu
Dimitrios Karkoulis dimit.nosp@m.ris..nosp@m.karko.nosp@m.ulis.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Teemu Virolainen teemu.nosp@m.@str.nosp@m.eamco.nosp@m.mput.nosp@m.ing.e.nosp@m.u

Functions

static bool runningOnCompatibleOSForAmd ()
 Return true if executing on compatible OS for AMD OpenCL. More...
 
static int is_gmx_supported_gpu_id (struct gmx_device_info_t *ocl_gpu_device)
 Returns true if the gpu characterized by the device properties is supported by the native gpu acceleration. More...
 
static ocl_vendor_id_t get_vendor_id (char *vendor_name)
 Returns an ocl_vendor_id_t value corresponding to the input OpenCL vendor name. More...
 
bool canDetectGpus (std::string *errorMessage)
 This function is documented in the header file. More...
 
void findGpus (gmx_gpu_info_t *gpu_info)
 This function is documented in the header file. More...
 
void free_gpu_info (const gmx_gpu_info_t *gpu_info)
 This function is documented in the header file.
 
std::vector< int > getCompatibleGpus (const gmx_gpu_info_t &gpu_info)
 This function is documented in the header file. More...
 
const char * getGpuCompatibilityDescription (const gmx_gpu_info_t &gpu_info, int index)
 This function is documented in the header file. More...
 
void get_gpu_device_info_string (char *s, const gmx_gpu_info_t &gpu_info, int index)
 This function is documented in the header file.
 
void init_gpu (const gmx::MDLogger &, gmx_device_info_t *deviceInfo)
 This function is documented in the header file. More...
 
gmx_device_info_tgetDeviceInfo (const gmx_gpu_info_t &gpu_info, int deviceId)
 This function is documented in the header file. More...
 
size_t sizeof_gpu_dev_info (void)
 This function is documented in the header file. More...
 
void gpu_set_host_malloc_and_free (bool bUseGpuKernels, gmx_host_alloc_t **nb_alloc, gmx_host_free_t **nb_free)
 Set page-locked memory allocation functions used by the GPU host. More...
 

Function Documentation

bool canDetectGpus ( std::string *  errorMessage)

This function is documented in the header file.

Return whether GPUs can be detected.

void findGpus ( gmx_gpu_info_t *  gpu_info)

This function is documented in the header file.

Find all GPUs in the system.

static ocl_vendor_id_t get_vendor_id ( char *  vendor_name)
static

Returns an ocl_vendor_id_t value corresponding to the input OpenCL vendor name.

Parameters
[in]vendor_nameString with OpenCL vendor name.
Returns
ocl_vendor_id_t value for the input vendor_name
std::vector<int> getCompatibleGpus ( const gmx_gpu_info_t &  gpu_info)

This function is documented in the header file.

Return a container of the detected GPUs that are compatible.

gmx_device_info_t* getDeviceInfo ( const gmx_gpu_info_t &  gpu_info,
int  deviceId 
)

This function is documented in the header file.

Return a pointer to the device info for deviceId.

const char* getGpuCompatibilityDescription ( const gmx_gpu_info_t &  gpu_info,
int  index 
)

This function is documented in the header file.

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

void gpu_set_host_malloc_and_free ( bool  bUseGpuKernels,
gmx_host_alloc_t **  nb_alloc,
gmx_host_free_t **  nb_free 
)

Set page-locked memory allocation functions used by the GPU host.

Set page-locked memory allocation functions used by the GPU host.

Since GPU support is not configured, there is no host memory to allocate.

void init_gpu ( const gmx::MDLogger ,
gmx_device_info_t deviceInfo 
)

This function is documented in the header file.

Initializes the GPU described by deviceInfo.

static int is_gmx_supported_gpu_id ( struct gmx_device_info_t ocl_gpu_device)
static

Returns true if the gpu characterized by the device properties is supported by the native gpu acceleration.

Returns
true if the GPU properties passed indicate a compatible GPU, otherwise false.
static bool runningOnCompatibleOSForAmd ( )
static

Return true if executing on compatible OS for AMD OpenCL.

This is assumed to be true for OS X version of at least 10.10.4 and all other OS flavors.

Uses the BSD sysctl() interfaces to extract the kernel version.

Returns
true if version is 14.4 or later (= OS X version 10.10.4), or OS is not Darwin.
size_t sizeof_gpu_dev_info ( void  )

This function is documented in the header file.

Returns the size of the gpu_dev_info struct.