Gromacs
2019.5
|
#include "gmxpre.h"
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <memory.h>
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/gpu_utils/ocl_compiler.h"
#include "gromacs/gpu_utils/oclraii.h"
#include "gromacs/gpu_utils/oclutils.h"
#include "gromacs/hardware/hw_info.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"
Define functions for detection and initialization for OpenCL devices.
Functions | |
static bool | runningOnCompatibleOSForAmd () |
Return true if executing on compatible OS for AMD OpenCL. More... | |
static std::string | gmx::makeOpenClInternalErrorString (const char *message, cl_int status) |
Make an error string following an OpenCL API call. More... | |
static bool | gmx::isDeviceSane (const gmx_device_info_t *devInfo, std::string *errorMessage) |
Checks that device devInfo is sane (ie can run a kernel). More... | |
static int | gmx::isDeviceSupported (const gmx_device_info_t *devInfo) |
Checks that device devInfo is compatible with GROMACS. More... | |
static int | gmx::checkGpu (size_t deviceId, const gmx_device_info_t *deviceInfo) |
Check whether the ocl_gpu_device is suitable for use by mdrun. 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 | get_gpu_device_info_string (char *s, const gmx_gpu_info_t &gpu_info, int index) |
This function is documented in the header file. More... | |
bool | areAllGpuDevicesFromAmd (const gmx_gpu_info_t &gpuInfo) |
Returns whether all compatible OpenCL devices are from AMD. More... | |
void | init_gpu (const gmx_device_info_t *deviceInfo) |
This function is documented in the header file. More... | |
gmx_device_info_t * | getDeviceInfo (const gmx_gpu_info_t &gpu_info, int deviceId) |
This function is documented in the header file. More... | |
size_t | sizeof_gpu_dev_info () |
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... | |
int | gpu_info_get_stat (const gmx_gpu_info_t &info, int index) |
Get status of device with specified index. | |
bool areAllGpuDevicesFromAmd | ( | const gmx_gpu_info_t & | gpuInfo | ) |
Returns whether all compatible OpenCL devices are from AMD.
This is currently the most useful and best tested platform for supported OpenCL devices, so some modules may need to check what degree of support they should offer.
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.
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.
Formats and returns a device information string for a given GPU.
|
static |
Returns an ocl_vendor_id_t value corresponding to the input OpenCL vendor name.
[in] | vendor_name | String with OpenCL vendor name. |
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
.
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_device_info_t * | deviceInfo | ) |
This function is documented in the header file.
Initializes the GPU described by deviceInfo
.
|
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.
size_t sizeof_gpu_dev_info | ( | ) |
This function is documented in the header file.
Returns the size of the gpu_dev_info struct.