From b37665a9fbb2997639f59cc72da22bfb485f23ad Mon Sep 17 00:00:00 2001 From: David Date: Mon, 2 May 2016 10:45:18 -0500 Subject: [PATCH] cuBLAS won't run if only emulation is available --- stim/envi/bip.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stim/envi/bip.h b/stim/envi/bip.h index 8314052..bce3cd5 100644 --- a/stim/envi/bip.h +++ b/stim/envi/bip.h @@ -1001,7 +1001,12 @@ public: bool co_matrix(double* co, double* avg, unsigned char *mask, bool PROGRESS = false){ #ifdef CUDA_FOUND - return co_matrix_cublas(co, avg, mask, PROGRESS); //if CUDA is available, use cuBLAS to calculate the covariance matrix + int dev_count; + cudaGetDeviceCount(&dev_count); //get the number of CUDA devices + cudaDeviceProp prop; + cudaGetDeviceProperties(&prop, 0); //get the property of the first device + if(dev_count > 0 && prop.major != 9999) //if the first device is not an emulator + return co_matrix_cublas(co, avg, mask, PROGRESS); //use cuBLAS to calculate the covariance matrix #endif progress = 0; //memory allocation -- libgit2 0.21.4