diff --git a/util/all_gpus.cpp b/util/all_gpus.cpp index 2737138..f35a994 100644 --- a/util/all_gpus.cpp +++ b/util/all_gpus.cpp @@ -31,6 +31,8 @@ class gpus_t { const gpu_t& select_gpu(int id) { auto& gpus = gpus_t::all(); + if (gpus.size() == 0) + CUDA_OK(cudaErrorNoDevice); if (id == -1) { int cuda_id; CUDA_OK(cudaGetDevice(&cuda_id));