How to check your pytorch / keras is using the GPU?

(Jeremy Howard (Admin)) #21

torch.cuda.set_device.

0 Likes

(Ryan Dsouza) #22

Thanks @jeremy

0 Likes

(saurabh) #23

Hi ,
This is what worked for me.
I ran below python code
import torch
torch.cuda.current_device()
Got this error:
The NVIDIA driver on your system is too old (found version 9000).
Please update your GPU driver by downloading and installing a new
version from the URL: http://www.nvidia.com/Download/index.aspx
Alternatively, go to: http://pytorch.org to install
a PyTorch version that has been compiled with your version
of the CUDA driver.

As per this this discussion :-
https://github.com/pytorch/pytorch/issues/4546

Installed cuda_9.1.85_win10.exe

worked smoothly afterwars.

Hope this help!

0 Likes

(Vinay Kumar) #24

It only tells the names of the GPU installed in your system that pyTorch can access. It doesn’t tell if your pyTorch code is using those GPUs.

0 Likes

#26

For Win 10 users, MSI Afterburner ( https://www.msi.com/page/afterburner ) is excellent for monitoring GPU/CPU/Memory utilization & temps. Afterburner is highly-regarded monitoring software with it’s roots in the gaming industry. It’s an aid to users trying to get the maximum from the their hardware, especially those overclocking. Works with most all Intel-based chipsets and NVIDIA GPUs. I’m using it with an Intel i7-8700 CPU and NVIDIA 1080Ti GPU.

0 Likes

#27

hi, I also run into similar to this… but sorry for a layman question… when i go to nvidia to install a new driver… which one is the correct one?
Geforce RTX 20 series (notebooks) 2080?and does game ready or create ready driver matter?
Many thanks!


AssertionError Traceback (most recent call last)
in
1 xb,_ = data.one_item(x)
2 xb_im = Image(data.denorm(xb)[0])
----> 3 xb = xb.cuda()

/opt/anaconda3/lib/python3.6/site-packages/torch/cuda/init.py in _lazy_init()
159 raise RuntimeError(
160 "Cannot re-initialize CUDA in forked subprocess. " + msg)
–> 161 _check_driver()
162 torch._C._cuda_init()
163 _cudart = _load_cudart()

/opt/anaconda3/lib/python3.6/site-packages/torch/cuda/init.py in _check_driver()
89 Alternatively, go to: https://pytorch.org to install
90 a PyTorch version that has been compiled with your version
—> 91 of the CUDA driver.""".format(str(torch._C._cuda_getDriverVersion())))
92
93

AssertionError:
The NVIDIA driver on your system is too old (found version 9020).
Please update your GPU driver by downloading and installing a new
version from the URL: http://www.nvidia.com/Download/index.aspx
Alternatively, go to: https://pytorch.org to install
a PyTorch version that has been compiled with your version
of the CUDA driver.

0 Likes