Created
March 8, 2019 00:01
-
-
Save Miladiouss/f53969888a9e9e930fabf3edcda07609 to your computer and use it in GitHub Desktop.
Ensure Python and PyTorch can detect all the GPUs in your system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GPU Detection Tests | |
from torch.cuda import device_count | |
import gpustat | |
print(""" | |
If pytorch raises "RuntimeError: cuda runtime error (30)" after suspension, | |
run the following commands in linux terminal: | |
sudo rmmod nvidia_uvm | |
sudo rmmod nvidia | |
sudo modprobe nvidia | |
sudo modprobe nvidia_uvm | |
""") | |
print('gpustat output:') | |
gpustat.print_gpustat() | |
print('\nPyTorch detected {} GPUs.'.format(device_count())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment