Skip to content

Commit

Permalink
Print out OpenCL device version for chosen device in output header
Browse files Browse the repository at this point in the history
Resolves UoB-HPC#4
  • Loading branch information
tomdeakin committed Sep 24, 2015
1 parent cecddb1 commit e608ec2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ocl-stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e608ec2

Please sign in to comment.