We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3166366 commit 524ec5fCopy full SHA for 524ec5f
src/runtime/cuda/cuda_device_api.cc
@@ -42,8 +42,9 @@ class CUDADeviceAPI final : public DeviceAPI {
42
int value = 0;
43
switch (kind) {
44
case kExist:
45
- value = (cudaDeviceGetAttribute(&value, cudaDevAttrMaxThreadsPerBlock, dev.device_id) ==
46
- cudaSuccess);
+ int count;
+ CUDA_CALL(cudaGetDeviceCount(&count));
47
+ value = static_cast<int>(dev.device_id < count);
48
break;
49
case kMaxThreadsPerBlock: {
50
CUDA_CALL(cudaDeviceGetAttribute(&value, cudaDevAttrMaxThreadsPerBlock, dev.device_id));
0 commit comments