Skip to content

Commit

Permalink
Display CUDA driver version in output header
Browse files Browse the repository at this point in the history
This mimics the OpenCL change in issue UoB-HPC#4.
  • Loading branch information
tomdeakin committed Sep 24, 2015
1 parent e608ec2 commit 70330c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cuda-stream.cu
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "common.h"

std::string getDeviceName(int device);
int getDriver(void);

// Code to check CUDA errors
void check_cuda_error(void)
Expand Down Expand Up @@ -162,6 +163,9 @@ int main(int argc, char *argv[])
// Print out device name
std::cout << "Using CUDA device " << getDeviceName(deviceIndex) << std::endl;

// Print out device CUDA driver version
std::cout << "Driver: " << getDriver() << std::endl;

// Check buffers fit on the device
cudaDeviceProp props;
cudaGetDeviceProperties(&props, deviceIndex);
Expand Down Expand Up @@ -358,6 +362,14 @@ std::string getDeviceName(int device)
return std::string(prop.name);
}

int getDriver(void)
{
int driver;
cudaDriverGetVersion(&driver);
check_cuda_error();
return driver;
}

void listDevices(void)
{
// Get number of devices
Expand Down

0 comments on commit 70330c7

Please sign in to comment.