Spaces:
Runtime error
Runtime error
ljy266987
commited on
Commit
•
5cb2a10
1
Parent(s):
87ba6b1
try
Browse files
app.py
CHANGED
@@ -4,21 +4,6 @@ import os
|
|
4 |
# 获取全部环境变量
|
5 |
env_vars = os.environ
|
6 |
|
7 |
-
os.environ["PYTORCH_NVML_BASED_CUDA_CHECK"] = "0"
|
8 |
-
import torch
|
9 |
-
|
10 |
-
if torch.cuda.is_available():
|
11 |
-
print("CUDA is available. Listing available GPUs:")
|
12 |
-
# 获取并打印GPU数量
|
13 |
-
num_gpus = torch.cuda.device_count()
|
14 |
-
for i in range(num_gpus):
|
15 |
-
print(f"GPU {i}: {torch.cuda.get_device_name(i)}")
|
16 |
-
# 其他相关信息,例如内存
|
17 |
-
print(f" Memory Allocated: {torch.cuda.memory_allocated(i) / 1024 ** 2:.0f} MB")
|
18 |
-
print(f" Memory Reserved: {torch.cuda.memory_reserved(i) / 1024 ** 2:.0f} MB")
|
19 |
-
else:
|
20 |
-
print("CUDA is not available.")
|
21 |
-
|
22 |
# 遍历并打印环境变量
|
23 |
for key, value in env_vars.items():
|
24 |
print(f"{key}: {value}")
|
|
|
4 |
# 获取全部环境变量
|
5 |
env_vars = os.environ
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# 遍历并打印环境变量
|
8 |
for key, value in env_vars.items():
|
9 |
print(f"{key}: {value}")
|