IF3D / check_gpu_availability
leobcc
Updated check_gpu_availability script
b1fef32
raw
history blame contribute delete
396 Bytes
import torch
if torch.cuda.is_available():
device = torch.device("cuda")
print("Torch version:",torch.__version__)
print("Is CUDA enabled?",torch.cuda.is_available())
print("Number of GPUs available:", torch.cuda.device_count())
print(f"GPU {torch.cuda.get_device_name(0)} is available")
else:
device = torch.device("cpu")
print("No GPU available, using CPU instead")