Print out OpenCL device version for chosen device in output header
Resolves #4
This commit is contained in:
parent
cecddb146b
commit
e608ec2909
@ -49,6 +49,7 @@
|
||||
#include "common.h"
|
||||
|
||||
std::string getDeviceName(const cl::Device& device);
|
||||
std::string getDeviceDriver(const cl::Device& device);
|
||||
unsigned getDeviceList(std::vector<cl::Device>& devices);
|
||||
|
||||
|
||||
@ -163,6 +164,10 @@ int main(int argc, char *argv[])
|
||||
std::string name = getDeviceName(device);
|
||||
std::cout << "Using OpenCL device " << name << std::endl;
|
||||
|
||||
// Print out OpenCL driver version for this device
|
||||
std::string driver = getDeviceDriver(device);
|
||||
std::cout << "Driver: " << driver << std::endl;
|
||||
|
||||
// Check device can do double precision if requested
|
||||
if (!useFloat && !device.getInfo<CL_DEVICE_DOUBLE_FP_CONFIG>())
|
||||
throw std::runtime_error("Device does not support double precision, please use --float");
|
||||
@ -442,6 +447,22 @@ std::string getDeviceName(const cl::Device& device)
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string getDeviceDriver(const cl::Device& device)
|
||||
{
|
||||
std::string driver;
|
||||
try
|
||||
{
|
||||
device.getInfo(CL_DRIVER_VERSION, &driver);
|
||||
}
|
||||
catch (cl::Error &e)
|
||||
{
|
||||
die("Getting device driver", e);
|
||||
}
|
||||
|
||||
return driver;
|
||||
}
|
||||
|
||||
|
||||
void listDevices(void)
|
||||
{
|
||||
// Get list of devices
|
||||
|
||||
Loading…
Reference in New Issue
Block a user