Skip to content

Instantly share code, notes, and snippets.

@ahmedbr
Created December 12, 2019 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmedbr/e57c2dfee63c0ef93963e90367649f35 to your computer and use it in GitHub Desktop.
Save ahmedbr/e57c2dfee63c0ef93963e90367649f35 to your computer and use it in GitHub Desktop.
Using GPU with PyTorch
1- Install PyTorch from the below link. Make sure you select the right CUDA version installed on your device:
https://pytorch.org/
2- After a successful installation. Feel free to test the following commands in your Command Line:
C:\Users\AhmedBr>python
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.current_device()
0
>>> torch.cuda.device(0)
<torch.cuda.device object at 0x0000028282DBAEF0>
>>> torch.cuda.device_count()
1
>>> torch.cuda.get_device_name(0)
'GeForce 930MX'
>>> torch.cuda.is_available()
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment