Closed jettjaniak closed 1 month ago
gpt says
import torch
import subprocess
def get_gpu_info():
if torch.cuda.is_available():
gpu_id = torch.cuda.current_device()
gpu_name = torch.cuda.get_device_name(gpu_id)
try:
result = subprocess.check_output(['nvidia-smi', '--query-gpu=gpu_name', '--format=csv,noheader'], encoding='utf-8')
gpu_name = result.strip().split('\n')[gpu_id]
except subprocess.CalledProcessError as e:
print(f"Error executing nvidia-smi: {e}")
gpu_name = torch.cuda.get_device_name(gpu_id)
return gpu_name
else:
return "No GPU available."
print(get_gpu_info())
it just says "cuda"