File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -27,25 +27,21 @@ extern "C" {
27
27
// CUDA Devices on the System
28
28
int cuda_num_devices ()
29
29
{
30
- int version;
30
+ int version = 0 , GPU_N = 0 ;
31
31
cudaError_t err = cudaDriverGetVersion (&version);
32
- if (err != cudaSuccess)
33
- {
32
+ if (err != cudaSuccess) {
34
33
applog (LOG_ERR, " Unable to query CUDA driver version! Is an nVidia driver installed?" );
35
34
exit (1 );
36
35
}
37
36
38
- int maj = version / 1000 , min = version % 100 ; // same as in deviceQuery sample
39
- if (maj < 5 || (maj == 5 && min < 5 ))
40
- {
41
- applog (LOG_ERR, " Driver does not support CUDA %d.%d API! Update your nVidia driver!" , 5 , 5 );
37
+ if (version < CUDART_VERSION) {
38
+ applog (LOG_ERR, " Your system does not support CUDA %d.%d API!" ,
39
+ CUDART_VERSION / 1000 , (CUDART_VERSION % 1000 ) / 10 );
42
40
exit (1 );
43
41
}
44
42
45
- int GPU_N;
46
43
err = cudaGetDeviceCount (&GPU_N);
47
- if (err != cudaSuccess)
48
- {
44
+ if (err != cudaSuccess) {
49
45
applog (LOG_ERR, " Unable to query number of CUDA devices! Is an nVidia driver installed?" );
50
46
exit (1 );
51
47
}
You can’t perform that action at this time.
0 commit comments