#include "gromacs/utility/iserializer.h"
struct DeviceInformation;
+enum class DeviceVendor : int;
/*! \brief Return whether GPUs can be detected.
*
*/
bool canComputeOnDevice();
+/*! \brief Returns an DeviceVendor value corresponding to the input OpenCL vendor name.
+ *
+ * \returns DeviceVendor value for the input vendor name
+ */
+DeviceVendor getDeviceVendor(const char* vendorName);
+
/*! \brief Find all GPUs in the system.
*
* Will detect every GPU supported by the device driver in use.
return canComputeOnDevice;
}
+DeviceVendor getDeviceVendor(const char* vendorName)
+{
+ if (vendorName)
+ {
+ if (strstr(vendorName, "NVIDIA"))
+ {
+ return DeviceVendor::Nvidia;
+ }
+ else if (strstr(vendorName, "AMD") || strstr(vendorName, "Advanced Micro Devices"))
+ {
+ return DeviceVendor::Amd;
+ }
+ else if (strstr(vendorName, "Intel"))
+ {
+ return DeviceVendor::Intel;
+ }
+ }
+ return DeviceVendor::Unknown;
+}
+
+
std::vector<std::reference_wrapper<DeviceInformation>>
getCompatibleDevices(const std::vector<std::unique_ptr<DeviceInformation>>& deviceInfoList)
{
namespace gmx
{
-/*! \brief Returns an DeviceVendor value corresponding to the input OpenCL vendor name.
- *
- * \returns DeviceVendor value for the input vendor name
- */
-static DeviceVendor getDeviceVendor(const char* vendorName)
-{
- if (vendorName)
- {
- if (strstr(vendorName, "NVIDIA"))
- {
- return DeviceVendor::Nvidia;
- }
- else if (strstr(vendorName, "AMD") || strstr(vendorName, "Advanced Micro Devices"))
- {
- return DeviceVendor::Amd;
- }
- else if (strstr(vendorName, "Intel"))
- {
- return DeviceVendor::Intel;
- }
- }
- return DeviceVendor::Unknown;
-}
-
/*! \brief 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
&(deviceInfoList[device_index]->adress_bits), nullptr);
deviceInfoList[device_index]->deviceVendor =
- gmx::getDeviceVendor(deviceInfoList[device_index]->vendorName);
+ getDeviceVendor(deviceInfoList[device_index]->vendorName);
clGetDeviceInfo(ocl_device_ids[j], CL_DEVICE_MAX_WORK_ITEM_SIZES, 3 * sizeof(size_t),
&deviceInfoList[device_index]->maxWorkItemSizes, nullptr);
size_t i = deviceInfos.size() - 1;
- deviceInfos[i]->id = i;
- deviceInfos[i]->syclDevice = syclDevice;
- deviceInfos[i]->status = checkDevice(i, *deviceInfos[i]);
- deviceInfos[i]->deviceVendor = DeviceVendor::Unknown;
+ deviceInfos[i]->id = i;
+ deviceInfos[i]->syclDevice = syclDevice;
+ deviceInfos[i]->status = checkDevice(i, *deviceInfos[i]);
+ deviceInfos[i]->deviceVendor =
+ getDeviceVendor(syclDevice.get_info<sycl::info::device::vendor>());
}
return deviceInfos;
}