Skip to content

Instantly share code, notes, and snippets.

@andrewssobral
Created July 23, 2019 14:57
Show Gist options
  • Save andrewssobral/7f9bae1690195e929f5602c3c9456252 to your computer and use it in GitHub Desktop.
Save andrewssobral/7f9bae1690195e929f5602c3c9456252 to your computer and use it in GitHub Desktop.
pytorch_gpu_test.py
import torch
print(torch.cuda.current_device())
# 0
print(torch.cuda.device(0))
# <torch.cuda.device at 0x...>
print(torch.cuda.device_count())
# 1
print(torch.cuda.get_device_name(0))
# 'GeForce RTX 2070'
print(torch.cuda.is_available())
# True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment