mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2025-08-23 23:35:31 +08:00
Test the compute capability minor number prior to using the result value.
This commit is contained in:
parent
a5267b83a5
commit
1b36fefcd5
@ -74,11 +74,11 @@ static CUdevice cudaDeviceInit(int *devMajor, int *devMinor)
|
|||||||
|
|
||||||
// Obtain the device's compute capability.
|
// Obtain the device's compute capability.
|
||||||
checkCudaErrors(cuDeviceGetAttribute(devMajor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice));
|
checkCudaErrors(cuDeviceGetAttribute(devMajor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice));
|
||||||
|
checkCudaErrors(cuDeviceGetAttribute(devMinor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice));
|
||||||
if (*devMajor < 7 && *devMinor < 5) {
|
if (*devMajor < 7 && *devMinor < 5) {
|
||||||
fprintf(stderr, "Device 0 is not sm_75 or later\n");
|
fprintf(stderr, "Device 0 is not sm_75 or later\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
checkCudaErrors(cuDeviceGetAttribute(devMinor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice));
|
|
||||||
|
|
||||||
return cuDevice;
|
return cuDevice;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user