Commit b37665a9fbb2997639f59cc72da22bfb485f23ad

Authored by David Mayerich
1 parent 9b2a5d71

cuBLAS won't run if only emulation is available

Showing 1 changed file with 6 additions and 1 deletions   Show diff stats
stim/envi/bip.h
... ... @@ -1001,7 +1001,12 @@ public:
1001 1001 bool co_matrix(double* co, double* avg, unsigned char *mask, bool PROGRESS = false){
1002 1002  
1003 1003 #ifdef CUDA_FOUND
1004   - return co_matrix_cublas(co, avg, mask, PROGRESS); //if CUDA is available, use cuBLAS to calculate the covariance matrix
  1004 + int dev_count;
  1005 + cudaGetDeviceCount(&dev_count); //get the number of CUDA devices
  1006 + cudaDeviceProp prop;
  1007 + cudaGetDeviceProperties(&prop, 0); //get the property of the first device
  1008 + if(dev_count > 0 && prop.major != 9999) //if the first device is not an emulator
  1009 + return co_matrix_cublas(co, avg, mask, PROGRESS); //use cuBLAS to calculate the covariance matrix
1005 1010 #endif
1006 1011 progress = 0;
1007 1012 //memory allocation
... ...