first commit

This commit is contained in:
game-loader
2025-06-16 14:21:04 +08:00
commit 636fda3598
6 changed files with 937 additions and 0 deletions

32
test.py Normal file
View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
"""
简单GPU检测脚本 - 检测系统是否有显卡及数量
"""
import torch
import cv2
def check_gpu():
"""检测GPU数量"""
print("🔍 正在检测GPU...")
# 检查CUDA是否可用
if torch.cuda.is_available():
gpu_count = torch.cuda.device_count()
print(f"✅ 检测到 {gpu_count} 张GPU")
print(f"cv2 检测到{cv2.cuda.getCudaEnabledDeviceCount()}张gpu")
# 显示GPU名称
for i in range(gpu_count):
gpu_name = torch.cuda.get_device_name(i)
print(f" GPU {i}: {gpu_name}")
else:
print("❌ 未检测到可用的GPU")
# 检查MPS (Apple Silicon)
if hasattr(torch.backends, 'mps') and torch.backends.mps.is_available():
print("✅ 检测到Apple Silicon GPU (MPS)")
if __name__ == "__main__":
check_gpu()