dshbase

插件目录 / Knowledge / dsh-gpu

dsh-gpu

已验证 · 实测可装 zytsyj

✓ 持续维护 2 位贡献者 基于 8 个官方 DSH 包 纯 TypeScript

查看 GitHub ↗ ← 返回插件目录

1Stars
0Forks
0未关闭 issue
TypeScript语言
2026-08-15最近推送
跨平台平台

功能简介

GPU感知执行层:gpu_status/gpu_exec/gpu_run_bg工具,自动选卡,逐步GPU上下文

✅
我们的评价
可用 — 实测通过,早期项目

GPU感知执行层:gpu_status/gpu_exec/gpu_run_bg工具,自动选卡,逐步GPU上下文 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

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 mounted ctx.shell executor's environment. Auto-select or pin gpuIndex; select count cards for multi-GPU commands.
  • gpu_run_bg — long-running GPU jobs (training, inference servers, benchmarks) register as a gpu job in ctx.jobs: returns a job id immediately, read with job_output, stop with job_kill.
  • Per-step context (optional, on by default) — injects a one-line GPU snapshot into eligible steps (the time-context pattern), 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-smi ignores CUDA_VISIBLE_DEVICES — it always reports physical indices. gpu_exec selection still works as intended for CUDA programs; just don't use nvidia-smi output inside gpu_exec to verify the pinning.
  • Selection is advisory, not a reservation: two concurrent agents can still pick the same card. For exclusive claims, pin gpuIndex from a gpu_status read in the same step.
  • gpu_run_bg requires the jobs service in the composition (@deepseek-ai/dsh-jobs + @deepseek-ai/dsh-tool-jobs), the same dependency background bash has.
  • Hosts without NVIDIA GPUs: gpu_status reports a clean no-gpu result 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

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-gpu」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

Web profile:

dsh plugin --profile web add dsh-gpu

Headless(CLI)profile:

dsh plugin --profile headless add dsh-gpu

包信息

npm:dsh-gpu · 版本 — · 实测环境 dsh 0.1.0-rc.6

实测报告

端到端验证通过:dsh 0.1.0-rc.6 上 L1 安装 + L2 加载 + L3 运行问答。

使用场景

给 agent 一套记忆、知识库或检索层,让它不再跨会话丢上下文。

适合谁

跑长项目、想让 agent 记住决策、文档和偏好而不用每次重讲的人。

二次开发建议

记忆/检索后端是缝——插新存储、调蒸馏策略,或加引用与审计轨迹。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Knowledge 里更多

浏览全部 7797 个插件 →