Better error message for no GPU or incompatible GPU
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 487
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 296
Description
Given this small but useless test program:
```
#include
#include
int main() {
thrust::device_vector dv;
thrust::sort(dv.begin(), dv.end());
}
```
When compiled with `nvcc -arch=sm_80 tiny.cu` and then run on a system that doesn't have any GPUs, the error message is:
```
terminate called after throwing an instance of 'thrust::system::system_error'
what(): radix_sort: failed on 1st step: cudaErrorInvalidDevice: invalid device ordinal
Aborted
```
When run a system with a Volta GPU (sm_70), it fails with:
```
terminate called after throwing an instance of 'thrust::system::system_error'
what(): radix_sort: failed on 1st step: cudaErrorInvalidDeviceFunction: invalid device function
Aborted
```
I don't expect either of those situations to work. The program should crash. What I would like is a better error message, one that gives a naive user some clue about what is happening. The first case should say something about no GPU being available, and the second should mention something about an incompatible GPU (saying that you are trying to run an sm_80 program on an sm_70 GPU would be awesome).
Making such a change will improve the user experience and make it easier for users to troubleshoot problems.
Contributor guide
Assessment
This issue has not been assessed yet.