Skip to content

Instantly share code, notes, and snippets.

@ptheywood
Created April 21, 2017 12:24
Show Gist options
  • Save ptheywood/057c26f3c5bfe22e55881fb37c006a8c to your computer and use it in GitHub Desktop.
Save ptheywood/057c26f3c5bfe22e55881fb37c006a8c to your computer and use it in GitHub Desktop.
FLAME GPU Device output. Place in an init function for now.
void outputDeviceInfo(){
cudaError_t err;
int deviceId;
err = cudaGetDevice(&deviceId);
if (err == cudaSuccess){
struct cudaDeviceProp prop;
err = cudaGetDeviceProperties(&prop, deviceId);
if (err == cudaSuccess){
printf("Device %i: %s, sm %i.%i\n", deviceId, prop.name, prop.major, prop.minor);
}
else
{
printf("Err: Device properties could not be loaded (%s)\n", cudaGetErrorString(err));
}
}
else
{
printf("Err: Cuda Device ID could not be loaded (%s)\n", cudaGetErrorString(err));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment