File size: 508 Bytes
ee594f0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # test_gpu.py
import torch
print(f"PyTorch version: {torch.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")
if torch.cuda.is_available():
print(f"GPU: {torch.cuda.get_device_name(0)}")
print(f"GPU Memory: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.2f} GB")
x = torch.randn(3, 3, 160, 192, 160).cuda()
print(f"Tensor on GPU: {x.device}")
del x
torch.cuda.empty_cache()
print("✅ CUDA is working!")
else:
print("❌ CUDA is NOT available") |