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

torch.cuda.set_device.

Thanks @jeremy

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!

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.

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.

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.

Now there seems to be a jupyter extension to monitor GPU usage. Iā€™m posting to so other people can find it more easily: https://developer.nvidia.com/blog/gpu-dashboards-in-jupyter-lab/.