-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtorch_checker.py
38 lines (31 loc) · 1.1 KB
/
torch_checker.py
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
31
32
33
34
35
36
37
38
import os
import torch
print(f"PyTorch version: {torch.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"CUDA version: {torch.version.cuda}")
if torch.cuda.is_available():
print(f"CUDNN version: {torch.backends.cudnn.version()}")
print(f"Number of GPUs: {torch.cuda.device_count()}")
print(f"Current GPU: {torch.cuda.get_device_name(torch.cuda.current_device())}")
print("\nEnvironment variables:")
for key, value in os.environ.items():
if "cuda" in key.lower() or "gpu" in key.lower() or "nvidia" in key.lower():
print(f"{key}: {value}")
print("\nCUDA library path:")
try:
print(torch.utils.cpp_extension.CUDA_HOME)
except:
print("CUDA_HOME not found")
if not torch.cuda.is_available():
print("\nChecking CUDA libraries:")
try:
import ctypes
ctypes.CDLL("nvcuda.dll")
print("nvcuda.dll loaded successfully")
except:
print("Failed to load nvcuda.dll")
try:
ctypes.CDLL("cudart64_110.dll")
print("cudart64_110.dll loaded successfully")
except:
print("Failed to load cudart64_110.dll")