Browse Source

Fix crash when building with cuda but without cuda devices

Samuel Thibault 8 years ago
parent
commit
8d6ca23dad
1 changed files with 13 additions and 10 deletions
  1. 13 10
      tests/microbenchs/matrix_as_vector.c

+ 13 - 10
tests/microbenchs/matrix_as_vector.c

@@ -237,18 +237,21 @@ int main(int argc, char **argv)
 	}
 
 #ifdef STARPU_USE_CUDA
-	cublasHandle_t handle;
-	cublasCreate(&handle);
-	cublasGetVersion(handle, &cublas_version);
-	cublasDestroy(handle);
-
 	devices = starpu_cuda_worker_get_count();
-	if (devices && cublas_version >= 7050)
+	if (devices)
 	{
-		starpu_cublas_init();
-		ret = check_size_on_device(STARPU_CUDA, "STARPU_CUDA");
-		if (ret) goto error;
-		starpu_cublas_shutdown();
+		cublasHandle_t handle;
+		cublasCreate(&handle);
+		cublasGetVersion(handle, &cublas_version);
+		cublasDestroy(handle);
+
+		if (cublas_version >= 7050)
+		{
+			starpu_cublas_init();
+			ret = check_size_on_device(STARPU_CUDA, "STARPU_CUDA");
+			if (ret) goto error;
+			starpu_cublas_shutdown();
+		}
 	}
 #endif
 #if 0