zytsyj/dsh-gpu
DeepSeek Harness 的 GPU 感知执行层:gpu_status / gpu_exec / gpu_run_bg 工具,自动显卡选择,逐步 GPU 上下文。
项目介绍Project Overview
dsh-gpu 是 DeepSeek Harness 的 GPU 感知执行层插件,提供 gpu_status、gpu_exec、gpu_run_bg 三个工具,并可选在每步注入 GPU 上下文摘要。命令通过已挂载的 shell 执行器运行,可自动选取最空闲显卡或固定 gpuIndex,支持本地或远程执行环境。适用于多卡训练、推理服务与基准测试。需注意:选卡是建议性而非独占,两个并发代理可能选到同一张卡。
dsh-gpu is a GPU-aware execution layer plugin for DeepSeek Harness. It exposes three tools — gpu_status, gpu_exec, and gpu_run_bg — plus an optional per-step GPU context line, routing commands through the mounted shell executor so it works with local hosts or any remote execution world. Use it for multi-GPU training, inference servers, and benchmarks with automatic or pinned card selection. Caveat: selection is advisory, not a reservation — concurrent agents may pick the same card, so pin gpuIndex from a same-step gpu_status read for exclusive claims.
请帮我了解并安装插件:【dsh-gpu】【https://github.com/zytsyj/dsh-gpu】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add dsh-gpu
把 zytsyj/dsh-gpu 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-gpu
GPU-aware execution layer for DeepSeek Harness (dsh). Out-of-tree plugin; no harness patches required.
Agents get three tools — gpu_status, gpu_exec, gpu_run_bg — plus an optional per-step GPU context line. Cards are selected automatically (freest first) with CUDA_VISIBLE_DEVICES set in the command environment; pin a card explicitly when you care.
8 GPU(s), free: [0,1,2,3,4,5,6,7]
GPU0 Tesla V100-SXM2-32GB: 4264/32768MiB 0%util 40C
...
[gpus 1 — GPU 1 (auto: freest 1)] exit 0
How it works
gpu_status— one query, every device: memory used/total, SM utilization, temperature, and a free/busy verdict. A device is busy at or above 80% memory used or 50% utilization (both configurable).gpu_exec— one-shot command with a selected card:CUDA_VISIBLE_DEVICES=<freest>is passed through the mountedctx.shellexecutor's environment. Auto-select or pingpuIndex; selectcountcards for multi-GPU commands.gpu_run_bg— long-running GPU jobs (training, inference servers, benchmarks) register as agpujob inctx.jobs: returns a job id immediately, read withjob_output, stop withjob_kill.- Per-step context (optional, on by default) — injects a one-line GPU snapshot into eligible steps (the
time-contextpattern), rate-limited to one sample per minute.
All execution rides the mounted shell executor. Local host, or any remote execution world (e.g. an SSH provider plugin) — dsh-gpu doesn't know or care where the GPUs are; it queries and launches through the same seam the bash tool uses.
Install
dsh-gpu is an out-of-tree bundle plugin. Install and activate it in a profile with the official plugin command:
dsh plugin --profile <name> add dsh-gpu
The package's bundled cordis.patch.yml registers the plugin automatically. To override its configuration, add an entry with the same id to the profile's cordis.patch.yml:
- insert:
- id: gpu
name: dsh-gpu
config:
stepContext: true
Load order note: place it after your execution-world plugins (e.g. an SSH provider) so the shell seam it queries is the one you intend.
Configuration
- id: gpu
name: dsh-gpu
config:
stepContext: true # per-step GPU snapshot line (default true)
refreshIntervalMs: 60000 # min spacing between injected snapshots
queryTimeoutMs: 10000 # nvidia-smi timeout
busyMemoryPct: 80 # >= this % memory used => busy
busyUtilPct: 50 # >= this % SM util => busy
Notes & gotchas
nvidia-smiignoresCUDA_VISIBLE_DEVICES— it always reports physical indices.gpu_execselection still works as intended for CUDA programs; just don't use nvidia-smi output insidegpu_execto verify the pinning.- Selection is advisory, not a reservation: two concurrent agents can still pick the same card. For exclusive claims, pin
gpuIndexfrom agpu_statusread in the same step. gpu_run_bgrequires the jobs service in the composition (@deepseek-ai/dsh-jobs+@deepseek-ai/dsh-tool-jobs), the same dependency backgroundbashhas.- Hosts without NVIDIA GPUs:
gpu_statusreports a cleanno-gpuresult instead of failing.
Development
pnpm install
pnpm typecheck # tsc --noEmit
pnpm test # vitest unit and plugin lifecycle tests
pnpm build # tsdown -> lib/
pnpm check:package # publint + Are the Types Wrong
node tests/live-v100.mjs # optional live probe (edit SSH target first)
Test fixtures are recorded from a live 8× Tesla V100-SXM2-32GB host (including one occupied card) — no mocking of nvidia-smi output formats.
License
MIT
nexu-io/open-design
ruvnet/ruflo
amruthpillai/reactive-resume
esengine/DeepSeek-Reasonix
volcengine/OpenViking
Molunerfinn/PicGo
titanwings/distilly
titanwings/colleague-skill