-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_gpu.py
More file actions
30 lines (24 loc) · 872 Bytes
/
Copy pathcheck_gpu.py
File metadata and controls
30 lines (24 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
import platform
import torch
print("=== System ===")
print("Python:", sys.version)
print("Platform:", platform.platform())
print("\n=== PyTorch ===")
print("Torch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
if torch.cuda.is_available():
print("CUDA version used by torch:", torch.version.cuda)
print("GPU count:", torch.cuda.device_count())
print("GPU name:", torch.cuda.get_device_name(0))
props = torch.cuda.get_device_properties(0)
total_vram_gb = props.total_memory / (1024 ** 3)
print(f"Total VRAM: {total_vram_gb:.2f} GB")
x = torch.randn(1024, 1024, device="cuda")
y = torch.randn(1024, 1024, device="cuda")
z = x @ y
torch.cuda.synchronize()
print("GPU tensor test: OK")
print("Result shape:", tuple(z.shape))
else:
print("No CUDA GPU detected by PyTorch.")