mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2025-08-23 23:40:31 +08:00
Merge branch 'dev/mattd/update-simple-cc-check' into 'master'
[nvvm] Test the compute capability minor number prior to using the result value. See merge request cuda-samples/cuda-samples!128
This commit is contained in:
commit
fbc40da311
@ -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