I'm using two graphic cards to test with some programs in CUDA. I think one of them is broken but the computer still recognizing it. How do I switch the "main graphic card" to run my program (if this exists) and discover if they are working properly?
Asked
Active
Viewed 448 times
0
-
[this](https://stackoverflow.com/q/31628407/7968757) or [this](https://stackoverflow.com/q/28112485/7968757) might be of interest. – BlameTheBits Apr 05 '19 at 19:35
1 Answers
1
This might help. You can use cudaSetDevice
to select which GPU you want to run on. You can also run nvidia-smi
from the command line to check which devices are visible on your system. Just be careful, the order from nvidia-smi is in PCIe order, while the driver and runtime do not guarantee that.
You can use cudaGetDeviceCount
to get the total number of visible devices, and then just loop that times, calling cudaSetDevice
with the index of the loop as an argument to set a new device to run on.
Hope this helps!