Skip to content

Commit

Permalink
Handle cudaErrorNoDevice (#8184)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
liujuncheng and mergify[bot] committed May 11, 2022
1 parent d653f59 commit 08e1e0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion oneflow/core/ep/cuda/cuda_device_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ size_t CudaDeviceManager::GetDeviceCount(size_t primary_device_index) {

size_t CudaDeviceManager::GetDeviceCount() {
int count = 0;
OF_CUDA_CHECK(cudaGetDeviceCount(&count));
cudaError_t err = cudaGetDeviceCount(&count);
if (err == cudaErrorNoDevice) { return 0; }
OF_CUDA_CHECK(err);
return count;
}

Expand Down

0 comments on commit 08e1e0b

Please sign in to comment.