Pytorch CUDA - GPU

PHOTO EMBED

Mon Apr 25 2022 07:51:01 GMT+0000 (UTC)

Saved by @hasitha #colab #torch #cuda #gpu

import torch
torch.cuda.is_available()

print('cuda available: ', torch.cuda.is_available())
print('device count: ', torch.cuda.device_count())
print('cuda current device: ', torch.cuda.current_device())
print('cude device name: ', torch.cuda.get_device_name(0))
print('allocated memory: ', torch.cuda.memory_allocated())
print('allocated memory: ', torch.cuda.memory_cached())

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
device
content_copyCOPY