-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_setup.py
More file actions
30 lines (24 loc) · 1 KB
/
check_setup.py
File metadata and controls
30 lines (24 loc) · 1 KB
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 torch
import platform
def check_env():
print(f"--- Environment Check on {platform.system()} ---")
print(f"Python Version: {platform.python_version()}")
print(f"PyTorch Version: {torch.__version__}")
# 1. Check for NVIDIA GPU (CUDA)
if torch.cuda.is_available():
print(f"✅ NVIDIA GPU Detected (CUDA)")
print(f"Device: {torch.cuda.get_device_name(0)}")
# 2. Check for AMD GPU (ROCm)
elif hasattr(torch.version, 'hip') and torch.version.hip is not None:
if torch.cuda.is_available():
print(f"✅ AMD GPU Detected (ROCm)")
print(f"Device: {torch.cuda.get_device_name(0)}")
else:
print("❌ AMD GPU Found but NOT active in PyTorch.")
# 3. Check for Apple Silicon GPU (MPS) - for our Mac freinds
elif torch.backends.mps.is_available():
print("✅ Apple Silicon GPU Detected (MPS)")
else:
print("⚠️ No GPU detected. Running on CPU.")
if __name__ == "__main__":
check_env()