cnb.bslu0WMUAGA
commited on
Commit
·
8be49ed
1
Parent(s):
e773b6b
hf
Browse files- 01/check_cuda.py +0 -19
- 01/cj.txt +0 -85
- 01/clearvram.py +0 -44
- 01/config.json +0 -15
- cj.txt +0 -85
- clearvram.py +0 -44
- config.json +0 -15
01/check_cuda.py
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
import pynvml
|
| 2 |
-
|
| 3 |
-
pynvml.nvmlInit()
|
| 4 |
-
handle = pynvml.nvmlDeviceGetHandleByIndex(0)
|
| 5 |
-
info = pynvml.nvmlDeviceGetMemoryInfo(handle)
|
| 6 |
-
print(f"显存总大小: {info.total / 1024**3:.2f} GB")
|
| 7 |
-
print(f"显存已用: {info.used / 1024**3:.2f} GB")
|
| 8 |
-
print(f"显存空闲: {info.free / 1024**3:.2f} GB")
|
| 9 |
-
|
| 10 |
-
try:
|
| 11 |
-
procs = pynvml.nvmlDeviceGetComputeRunningProcesses(handle)
|
| 12 |
-
if len(procs) == 0:
|
| 13 |
-
print("⚠️ 没有检测到计算进程(可能被隐藏或在容器外)")
|
| 14 |
-
for p in procs:
|
| 15 |
-
print(f"PID: {p.pid}, 显存占用: {p.usedGpuMemory / 1024**2:.0f} MB")
|
| 16 |
-
except Exception as e:
|
| 17 |
-
print(f"获取进程失败: {e}")
|
| 18 |
-
|
| 19 |
-
pynvml.nvmlShutdown()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
01/cj.txt
DELETED
|
@@ -1,85 +0,0 @@
|
|
| 1 |
-
https://github.com/Comfy-Org/ComfyUI-Manager.git
|
| 2 |
-
https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git
|
| 3 |
-
https://github.com/antrobot1234/antrobots-comfyUI-nodepack.git
|
| 4 |
-
https://github.com/siliconflow/BizyAir.git
|
| 5 |
-
https://github.com/chrisgoringe/cg-image-picker.git
|
| 6 |
-
https://github.com/chrisgoringe/cg-training-tools.git
|
| 7 |
-
https://github.com/chrisgoringe/cg-use-everywhere.git
|
| 8 |
-
https://github.com/M1kep/Comfy_KepListStuff.git
|
| 9 |
-
https://github.com/melMass/comfy_mtb.git
|
| 10 |
-
https://github.com/giriss/comfy-image-saver.git
|
| 11 |
-
https://github.com/evanspearman/ComfyMath.git
|
| 12 |
-
https://github.com/Eagle-CN/ComfyUI-Addoor.git
|
| 13 |
-
https://github.com/kaibioinfo/ComfyUI_AdvancedRefluxControl.git
|
| 14 |
-
https://github.com/comfyanonymous/ComfyUI_bitsandbytes_NF4.git
|
| 15 |
-
https://github.com/chflame163/ComfyUI_CatVTON_Wrapper.git
|
| 16 |
-
https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git
|
| 17 |
-
https://github.com/Fannovel16/comfyui_controlnet_aux.git
|
| 18 |
-
https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet.git
|
| 19 |
-
https://github.com/cubiq/ComfyUI_essentials.git
|
| 20 |
-
https://github.com/yuvraj108c/ComfyUI_InvSR.git
|
| 21 |
-
https://github.com/cubiq/ComfyUI_IPAdapter_plus.git
|
| 22 |
-
https://github.com/smthemex/ComfyUI_KV_Edit.git
|
| 23 |
-
https://github.com/chflame163/ComfyUI_LayerStyle.git
|
| 24 |
-
https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git
|
| 25 |
-
https://github.com/heshengtao/comfyui_LLM_party.git
|
| 26 |
-
https://github.com/BlenderNeko/ComfyUI_Noise.git
|
| 27 |
-
https://github.com/TTPlanetPig/Comfyui_Object_Migration.git
|
| 28 |
-
https://github.com/HM-RunningHub/ComfyUI_RH_LLM_API.git
|
| 29 |
-
https://github.com/storyicon/comfyui_segment_anything.git
|
| 30 |
-
https://github.com/EvilBT/ComfyUI_SLK_joy_caption_two.git
|
| 31 |
-
https://github.com/TTPlanetPig/Comfyui_TTP_Toolset.git
|
| 32 |
-
https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git
|
| 33 |
-
https://github.com/ALatentPlace/ComfyUI_yanc.git
|
| 34 |
-
https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet.git
|
| 35 |
-
https://github.com/lujiazho/ComfyUI-CatvtonFluxWrapper.git
|
| 36 |
-
https://github.com/crystian/ComfyUI-Crystools.git
|
| 37 |
-
https://github.com/pythongosssss/ComfyUI-Custom-Scripts.git
|
| 38 |
-
https://github.com/yolain/ComfyUI-Easy-Use.git
|
| 39 |
-
https://github.com/EeroHeikkinen/ComfyUI-eesahesNodes.git
|
| 40 |
-
https://github.com/TencentQQGYLab/ComfyUI-ELLA.git
|
| 41 |
-
https://github.com/kijai/ComfyUI-Florence2.git
|
| 42 |
-
https://github.com/logtd/ComfyUI-Fluxtapoz.git
|
| 43 |
-
https://github.com/kijai/ComfyUI-FluxTrainer.git
|
| 44 |
-
https://github.com/city96/ComfyUI-GGUF.git
|
| 45 |
-
https://github.com/ltdrdata/ComfyUI-Impact-Pack.git
|
| 46 |
-
https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch.git
|
| 47 |
-
https://github.com/Acly/comfyui-inpaint-nodes.git
|
| 48 |
-
https://github.com/Shakker-Labs/ComfyUI-IPAdapter-Flux.git
|
| 49 |
-
https://github.com/daxcay/ComfyUI-JDCN.git
|
| 50 |
-
https://github.com/kijai/ComfyUI-KJNodes.git
|
| 51 |
-
https://github.com/MinusZoneAI/ComfyUI-Kolors-MZ.git
|
| 52 |
-
https://github.com/mingsky-ai/ComfyUI-MingNodes.git
|
| 53 |
-
https://github.com/huanngzh/ComfyUI-MVAdapter.git
|
| 54 |
-
https://github.com/mit-han-lab/ComfyUI-nunchaku.git
|
| 55 |
-
https://github.com/ZHO-ZHO-ZHO/ComfyUI-Phi-3-mini.git
|
| 56 |
-
https://github.com/NimaNzrii/comfyui-photoshop.git
|
| 57 |
-
https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git
|
| 58 |
-
https://github.com/neverbiasu/ComfyUI-SAM2.git
|
| 59 |
-
https://github.com/kijai/ComfyUI-segment-anything-2.git
|
| 60 |
-
https://github.com/JettHu/ComfyUI-TCD.git
|
| 61 |
-
https://github.com/un-seen/comfyui-tensorops.git
|
| 62 |
-
https://github.com/Acly/comfyui-tooling-nodes.git
|
| 63 |
-
https://github.com/kijai/ComfyUI-KJNodes.git
|
| 64 |
-
https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git
|
| 65 |
-
https://github.com/kijai/ComfyUI-WanVideoWrapper.git
|
| 66 |
-
https://github.com/pythongosssss/ComfyUI-WD14-Tagger.git
|
| 67 |
-
https://github.com/chengzeyi/Comfy-WaveSpeed.git
|
| 68 |
-
https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes.git
|
| 69 |
-
https://github.com/Xiangyu-CAS/HandFixer.git
|
| 70 |
-
https://github.com/christian-byrne/img2txt-comfyui-nodes.git
|
| 71 |
-
https://github.com/TheMistoAI/MistoControlNet-Flux-dev.git
|
| 72 |
-
https://github.com/AIrjen/OneButtonPrompt.git
|
| 73 |
-
https://github.com/WASasquatch/PowerNoiseSuite.git
|
| 74 |
-
https://github.com/rgthree/rgthree-comfy.git
|
| 75 |
-
https://github.com/WASasquatch/was-node-suite-comfyui.git
|
| 76 |
-
https://github.com/XLabs-AI/x-flux-comfyui.git
|
| 77 |
-
https://github.com/welltop-cn/ComfyUI-TeaCache.git
|
| 78 |
-
https://github.com/chflame163/ComfyUI_BaiduTranslate.git
|
| 79 |
-
https://github.com/jamesWalker55/comfyui-various.git
|
| 80 |
-
https://github.com/1038lab/ComfyUI-RMBG.git
|
| 81 |
-
https://github.com/yichengup/Comfyui_Redux_Advanced.git
|
| 82 |
-
https://github.com/erosDiffusion/ComfyUI-enricos-nodes.git
|
| 83 |
-
https://github.com/uinodes/ComfyUI-uinodesDOC.git
|
| 84 |
-
https://github.com/ChenDarYen/ComfyUI-NAG.git
|
| 85 |
-
https://github.com/CY-CHENYUE/ComfyUI-InpaintEasy.git
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
01/clearvram.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
import torch
|
| 3 |
-
import pynvml
|
| 4 |
-
import gc
|
| 5 |
-
import ctypes
|
| 6 |
-
import subprocess
|
| 7 |
-
|
| 8 |
-
def soft_reset():
|
| 9 |
-
torch.cuda.empty_cache()
|
| 10 |
-
gc.collect()
|
| 11 |
-
print("✅ PyTorch empty_cache + gc")
|
| 12 |
-
|
| 13 |
-
def cuda_context_reset():
|
| 14 |
-
"""销毁当前 Python 的 CUDA context(兼容新 PyTorch)"""
|
| 15 |
-
# 1. 释放所有 tensor
|
| 16 |
-
for obj in gc.get_objects():
|
| 17 |
-
if torch.is_tensor(obj) and obj.is_cuda:
|
| 18 |
-
del obj
|
| 19 |
-
torch.cuda.empty_cache()
|
| 20 |
-
# 2. 重新建 context(触发一次 malloc)
|
| 21 |
-
tmp = torch.zeros(1, device='cuda')
|
| 22 |
-
del tmp
|
| 23 |
-
torch.cuda.empty_cache()
|
| 24 |
-
print("✅ CUDA context 软重置(兼容新版)")
|
| 25 |
-
|
| 26 |
-
def cuda_ipc_clean():
|
| 27 |
-
libc = ctypes.CDLL("libcudart.so")
|
| 28 |
-
libc.cudaDeviceSynchronize()
|
| 29 |
-
libc.cudaDeviceReset()
|
| 30 |
-
print("✅ cudaDeviceReset(无 root)")
|
| 31 |
-
|
| 32 |
-
def nvidia_smi_reset():
|
| 33 |
-
try:
|
| 34 |
-
subprocess.run(["nvidia-smi", "-r", "-i", "0"], check=True)
|
| 35 |
-
print("✅ GPU 整卡重置完成")
|
| 36 |
-
except subprocess.CalledProcessError:
|
| 37 |
-
print("❌ 整卡重置失败(无 sudo 或驱动不支持)")
|
| 38 |
-
|
| 39 |
-
# --------- 依次尝试 ---------
|
| 40 |
-
print("=== 显存清道夫(无 root 版)===")
|
| 41 |
-
soft_reset()
|
| 42 |
-
cuda_context_reset()
|
| 43 |
-
cuda_ipc_clean()
|
| 44 |
-
nvidia_smi_reset()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
01/config.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"network": {
|
| 3 |
-
"Token": 17460125448126794081,
|
| 4 |
-
"Node": "nihao2024_nihao2024_nihao2024",
|
| 5 |
-
"User": "kenicken001",
|
| 6 |
-
"ShareBandwidth": 10,
|
| 7 |
-
"ServerHost": "api.openp2p.cn",
|
| 8 |
-
"ServerPort": 27183,
|
| 9 |
-
"PublicIPPort": 58510
|
| 10 |
-
},
|
| 11 |
-
"apps": null,
|
| 12 |
-
"LogLevel": 1,
|
| 13 |
-
"MaxLogSize": 1048576,
|
| 14 |
-
"TLSInsecureSkipVerify": false
|
| 15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cj.txt
DELETED
|
@@ -1,85 +0,0 @@
|
|
| 1 |
-
https://github.com/Comfy-Org/ComfyUI-Manager.git
|
| 2 |
-
https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git
|
| 3 |
-
https://github.com/antrobot1234/antrobots-comfyUI-nodepack.git
|
| 4 |
-
https://github.com/siliconflow/BizyAir.git
|
| 5 |
-
https://github.com/chrisgoringe/cg-image-picker.git
|
| 6 |
-
https://github.com/chrisgoringe/cg-training-tools.git
|
| 7 |
-
https://github.com/chrisgoringe/cg-use-everywhere.git
|
| 8 |
-
https://github.com/M1kep/Comfy_KepListStuff.git
|
| 9 |
-
https://github.com/melMass/comfy_mtb.git
|
| 10 |
-
https://github.com/giriss/comfy-image-saver.git
|
| 11 |
-
https://github.com/evanspearman/ComfyMath.git
|
| 12 |
-
https://github.com/Eagle-CN/ComfyUI-Addoor.git
|
| 13 |
-
https://github.com/kaibioinfo/ComfyUI_AdvancedRefluxControl.git
|
| 14 |
-
https://github.com/comfyanonymous/ComfyUI_bitsandbytes_NF4.git
|
| 15 |
-
https://github.com/chflame163/ComfyUI_CatVTON_Wrapper.git
|
| 16 |
-
https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git
|
| 17 |
-
https://github.com/Fannovel16/comfyui_controlnet_aux.git
|
| 18 |
-
https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet.git
|
| 19 |
-
https://github.com/cubiq/ComfyUI_essentials.git
|
| 20 |
-
https://github.com/yuvraj108c/ComfyUI_InvSR.git
|
| 21 |
-
https://github.com/cubiq/ComfyUI_IPAdapter_plus.git
|
| 22 |
-
https://github.com/smthemex/ComfyUI_KV_Edit.git
|
| 23 |
-
https://github.com/chflame163/ComfyUI_LayerStyle.git
|
| 24 |
-
https://github.com/chflame163/ComfyUI_LayerStyle_Advance.git
|
| 25 |
-
https://github.com/heshengtao/comfyui_LLM_party.git
|
| 26 |
-
https://github.com/BlenderNeko/ComfyUI_Noise.git
|
| 27 |
-
https://github.com/TTPlanetPig/Comfyui_Object_Migration.git
|
| 28 |
-
https://github.com/HM-RunningHub/ComfyUI_RH_LLM_API.git
|
| 29 |
-
https://github.com/storyicon/comfyui_segment_anything.git
|
| 30 |
-
https://github.com/EvilBT/ComfyUI_SLK_joy_caption_two.git
|
| 31 |
-
https://github.com/TTPlanetPig/Comfyui_TTP_Toolset.git
|
| 32 |
-
https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git
|
| 33 |
-
https://github.com/ALatentPlace/ComfyUI_yanc.git
|
| 34 |
-
https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet.git
|
| 35 |
-
https://github.com/lujiazho/ComfyUI-CatvtonFluxWrapper.git
|
| 36 |
-
https://github.com/crystian/ComfyUI-Crystools.git
|
| 37 |
-
https://github.com/pythongosssss/ComfyUI-Custom-Scripts.git
|
| 38 |
-
https://github.com/yolain/ComfyUI-Easy-Use.git
|
| 39 |
-
https://github.com/EeroHeikkinen/ComfyUI-eesahesNodes.git
|
| 40 |
-
https://github.com/TencentQQGYLab/ComfyUI-ELLA.git
|
| 41 |
-
https://github.com/kijai/ComfyUI-Florence2.git
|
| 42 |
-
https://github.com/logtd/ComfyUI-Fluxtapoz.git
|
| 43 |
-
https://github.com/kijai/ComfyUI-FluxTrainer.git
|
| 44 |
-
https://github.com/city96/ComfyUI-GGUF.git
|
| 45 |
-
https://github.com/ltdrdata/ComfyUI-Impact-Pack.git
|
| 46 |
-
https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch.git
|
| 47 |
-
https://github.com/Acly/comfyui-inpaint-nodes.git
|
| 48 |
-
https://github.com/Shakker-Labs/ComfyUI-IPAdapter-Flux.git
|
| 49 |
-
https://github.com/daxcay/ComfyUI-JDCN.git
|
| 50 |
-
https://github.com/kijai/ComfyUI-KJNodes.git
|
| 51 |
-
https://github.com/MinusZoneAI/ComfyUI-Kolors-MZ.git
|
| 52 |
-
https://github.com/mingsky-ai/ComfyUI-MingNodes.git
|
| 53 |
-
https://github.com/huanngzh/ComfyUI-MVAdapter.git
|
| 54 |
-
https://github.com/mit-han-lab/ComfyUI-nunchaku.git
|
| 55 |
-
https://github.com/ZHO-ZHO-ZHO/ComfyUI-Phi-3-mini.git
|
| 56 |
-
https://github.com/NimaNzrii/comfyui-photoshop.git
|
| 57 |
-
https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git
|
| 58 |
-
https://github.com/neverbiasu/ComfyUI-SAM2.git
|
| 59 |
-
https://github.com/kijai/ComfyUI-segment-anything-2.git
|
| 60 |
-
https://github.com/JettHu/ComfyUI-TCD.git
|
| 61 |
-
https://github.com/un-seen/comfyui-tensorops.git
|
| 62 |
-
https://github.com/Acly/comfyui-tooling-nodes.git
|
| 63 |
-
https://github.com/kijai/ComfyUI-KJNodes.git
|
| 64 |
-
https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git
|
| 65 |
-
https://github.com/kijai/ComfyUI-WanVideoWrapper.git
|
| 66 |
-
https://github.com/pythongosssss/ComfyUI-WD14-Tagger.git
|
| 67 |
-
https://github.com/chengzeyi/Comfy-WaveSpeed.git
|
| 68 |
-
https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes.git
|
| 69 |
-
https://github.com/Xiangyu-CAS/HandFixer.git
|
| 70 |
-
https://github.com/christian-byrne/img2txt-comfyui-nodes.git
|
| 71 |
-
https://github.com/TheMistoAI/MistoControlNet-Flux-dev.git
|
| 72 |
-
https://github.com/AIrjen/OneButtonPrompt.git
|
| 73 |
-
https://github.com/WASasquatch/PowerNoiseSuite.git
|
| 74 |
-
https://github.com/rgthree/rgthree-comfy.git
|
| 75 |
-
https://github.com/WASasquatch/was-node-suite-comfyui.git
|
| 76 |
-
https://github.com/XLabs-AI/x-flux-comfyui.git
|
| 77 |
-
https://github.com/welltop-cn/ComfyUI-TeaCache.git
|
| 78 |
-
https://github.com/chflame163/ComfyUI_BaiduTranslate.git
|
| 79 |
-
https://github.com/jamesWalker55/comfyui-various.git
|
| 80 |
-
https://github.com/1038lab/ComfyUI-RMBG.git
|
| 81 |
-
https://github.com/yichengup/Comfyui_Redux_Advanced.git
|
| 82 |
-
https://github.com/erosDiffusion/ComfyUI-enricos-nodes.git
|
| 83 |
-
https://github.com/uinodes/ComfyUI-uinodesDOC.git
|
| 84 |
-
https://github.com/ChenDarYen/ComfyUI-NAG.git
|
| 85 |
-
https://github.com/CY-CHENYUE/ComfyUI-InpaintEasy.git
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clearvram.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
import torch
|
| 3 |
-
import pynvml
|
| 4 |
-
import gc
|
| 5 |
-
import ctypes
|
| 6 |
-
import subprocess
|
| 7 |
-
|
| 8 |
-
def soft_reset():
|
| 9 |
-
torch.cuda.empty_cache()
|
| 10 |
-
gc.collect()
|
| 11 |
-
print("✅ PyTorch empty_cache + gc")
|
| 12 |
-
|
| 13 |
-
def cuda_context_reset():
|
| 14 |
-
"""销毁当前 Python 的 CUDA context(兼容新 PyTorch)"""
|
| 15 |
-
# 1. 释放所有 tensor
|
| 16 |
-
for obj in gc.get_objects():
|
| 17 |
-
if torch.is_tensor(obj) and obj.is_cuda:
|
| 18 |
-
del obj
|
| 19 |
-
torch.cuda.empty_cache()
|
| 20 |
-
# 2. 重新建 context(触发一次 malloc)
|
| 21 |
-
tmp = torch.zeros(1, device='cuda')
|
| 22 |
-
del tmp
|
| 23 |
-
torch.cuda.empty_cache()
|
| 24 |
-
print("✅ CUDA context 软重置(兼容新版)")
|
| 25 |
-
|
| 26 |
-
def cuda_ipc_clean():
|
| 27 |
-
libc = ctypes.CDLL("libcudart.so")
|
| 28 |
-
libc.cudaDeviceSynchronize()
|
| 29 |
-
libc.cudaDeviceReset()
|
| 30 |
-
print("✅ cudaDeviceReset(无 root)")
|
| 31 |
-
|
| 32 |
-
def nvidia_smi_reset():
|
| 33 |
-
try:
|
| 34 |
-
subprocess.run(["nvidia-smi", "-r", "-i", "0"], check=True)
|
| 35 |
-
print("✅ GPU 整卡重置完成")
|
| 36 |
-
except subprocess.CalledProcessError:
|
| 37 |
-
print("❌ 整卡重置失败(无 sudo 或驱动不支持)")
|
| 38 |
-
|
| 39 |
-
# --------- 依次尝试 ---------
|
| 40 |
-
print("=== 显存清道夫(无 root 版)===")
|
| 41 |
-
soft_reset()
|
| 42 |
-
cuda_context_reset()
|
| 43 |
-
cuda_ipc_clean()
|
| 44 |
-
nvidia_smi_reset()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"network": {
|
| 3 |
-
"Token": 17460125448126794081,
|
| 4 |
-
"Node": "nihao2024_nihao2024_nihao2024",
|
| 5 |
-
"User": "kenicken001",
|
| 6 |
-
"ShareBandwidth": 10,
|
| 7 |
-
"ServerHost": "api.openp2p.cn",
|
| 8 |
-
"ServerPort": 27183,
|
| 9 |
-
"PublicIPPort": 58510
|
| 10 |
-
},
|
| 11 |
-
"apps": null,
|
| 12 |
-
"LogLevel": 1,
|
| 13 |
-
"MaxLogSize": 1048576,
|
| 14 |
-
"TLSInsecureSkipVerify": false
|
| 15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|