Lumen / app.py
Fly-ShuAI's picture
Update app.py
0a0582d verified
raw
history blame
456 Bytes
import torch
device = f'cuda:0' if torch.cuda.is_available() else 'cpu'
print('device:', device)
torch_version = torch.__version__
print('torch_version:', torch_version)
# 获取机器的CUDA版本
# 在机器中输入命令nvidia-smi
import subprocess
try:
result = subprocess.run(['nvidia-smi'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print('nvidia-smi output:', result.stdout)
except Exception as e:
print(f'Error: {e}')