dsh-nvtop-panel 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/client.js +20 -4
- package/index.js +83 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,9 +32,12 @@ PID USER DEV TYPE GPU GPU MEM CPU HOST MEM Command
|
|
|
32
32
|
HOST MEM · Command`. GPU memory comes from `nvidia-smi --query-compute-apps`; user,
|
|
33
33
|
CPU %, host RSS, and full command line come from one batched `ps` call; each process
|
|
34
34
|
is mapped to its device via GPU UUID.
|
|
35
|
-
- `TYPE` is `C` (compute)
|
|
36
|
-
- `GPU` is
|
|
37
|
-
|
|
35
|
+
- `TYPE` is `C` (compute) or `G` (graphics), as reported by `nvidia-smi pmon`.
|
|
36
|
+
- `GPU` is **this process's own SM (compute) utilisation** on its device, read
|
|
37
|
+
from `nvidia-smi pmon`, matched by device *and* pid — never the whole-GPU
|
|
38
|
+
figure. A process with no SM activity in the sample window shows `0%`.
|
|
39
|
+
On a driver that does not report per-process figures the column shows `—`
|
|
40
|
+
rather than substituting a misleading number.
|
|
38
41
|
- **Auto-refresh**, interval configurable per profile (default 2 s), server samples
|
|
39
42
|
cached 1 s so overlapping polls share one `nvidia-smi` run.
|
|
40
43
|
- **Theme-native UI**: all styling uses DSH theme tokens (`--dsw-alias-*`), light/dark
|
|
@@ -115,10 +118,9 @@ A peer without an NVIDIA GPU shows a note instead of silently disappearing.
|
|
|
115
118
|
Anyone who can open this DSH page can read the peer units' process tables;
|
|
116
119
|
peers are therefore exactly as visible as the dsh user's SSH keys allow.
|
|
117
120
|
|
|
118
|
-
Per-process
|
|
119
|
-
driver-level
|
|
120
|
-
|
|
121
|
-
as nvtop does on this hardware.
|
|
121
|
+
Per-process SM utilisation comes from `nvidia-smi pmon`. Per-process unified-memory
|
|
122
|
+
splits remain a driver-level statistic that `nvidia-smi` does not expose: `GPU MEM` is
|
|
123
|
+
the compute-app allocation, as nvtop does on this hardware.
|
|
122
124
|
|
|
123
125
|
## Verify
|
|
124
126
|
|
package/client.js
CHANGED
|
@@ -35,6 +35,8 @@ window.__ModuleLoader__.load({
|
|
|
35
35
|
cpu: 'CPU',
|
|
36
36
|
hostMem: 'HOST MEM',
|
|
37
37
|
command: 'Command',
|
|
38
|
+
gpuTitle: 'This process\'s own SM (compute) utilisation on its GPU, not the whole-GPU figure',
|
|
39
|
+
gpuMemTitle: 'GPU memory allocated to this process',
|
|
38
40
|
},
|
|
39
41
|
};
|
|
40
42
|
|
|
@@ -63,6 +65,16 @@ window.__ModuleLoader__.load({
|
|
|
63
65
|
return value === null || value === undefined ? '—' : `${Math.round(value)}%`;
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Per-process SM utilisation. pmon prints "-" for a context that used no SM
|
|
70
|
+
* time in the sample window, which reads as 0 % only when the driver does
|
|
71
|
+
* report per-process figures; otherwise the figure is simply unavailable.
|
|
72
|
+
*/
|
|
73
|
+
function fmtProcGpu(p, utilReported) {
|
|
74
|
+
if (p.gpuUtilization !== null && p.gpuUtilization !== undefined) return `${Math.round(p.gpuUtilization)}%`;
|
|
75
|
+
return utilReported ? '0%' : '—';
|
|
76
|
+
}
|
|
77
|
+
|
|
66
78
|
function levelClass(ratio) {
|
|
67
79
|
if (ratio === null || ratio === undefined) return 'nvtp-empty';
|
|
68
80
|
if (ratio >= 0.9) return 'nvtp-hot';
|
|
@@ -152,8 +164,8 @@ window.__ModuleLoader__.load({
|
|
|
152
164
|
h('th', null, t('user')),
|
|
153
165
|
h('th', { className: 'nvtp-num', title: multiUnit ? 'unit index' : undefined }, t('dev')),
|
|
154
166
|
h('th', null, t('type')),
|
|
155
|
-
h('th', { className: 'nvtp-num' }, t('gpu')),
|
|
156
|
-
h('th', { className: 'nvtp-num' }, t('gpuMem')),
|
|
167
|
+
h('th', { className: 'nvtp-num', title: t('gpuTitle') }, t('gpu')),
|
|
168
|
+
h('th', { className: 'nvtp-num', title: t('gpuMemTitle') }, t('gpuMem')),
|
|
157
169
|
h('th', { className: 'nvtp-num' }, t('cpu')),
|
|
158
170
|
h('th', { className: 'nvtp-num' }, t('hostMem')),
|
|
159
171
|
h('th', { className: 'nvtp-cmd' }, t('command')))),
|
|
@@ -163,7 +175,7 @@ window.__ModuleLoader__.load({
|
|
|
163
175
|
h('td', { className: 'nvtp-user' }, p.user ?? '—'),
|
|
164
176
|
h('td', { className: 'nvtp-num' }, deviceText(p)),
|
|
165
177
|
h('td', { className: 'nvtp-type' }, p.type ?? '—'),
|
|
166
|
-
h('td', { className: 'nvtp-num' },
|
|
178
|
+
h('td', { className: 'nvtp-num', title: t('gpuTitle') }, fmtProcGpu(p, p.utilReported === true)),
|
|
167
179
|
h('td', { className: 'nvtp-num' }, fmtMemory(p.memoryUsed)),
|
|
168
180
|
h('td', { className: 'nvtp-num' }, p.cpuPercent === null || p.cpuPercent === undefined ? '—' : `${p.cpuPercent.toFixed(1)}%`),
|
|
169
181
|
h('td', { className: 'nvtp-num' }, fmtHostMemory(p.hostMemKib)),
|
|
@@ -280,7 +292,11 @@ window.__ModuleLoader__.load({
|
|
|
280
292
|
const totalGpus = liveUnits.reduce((sum, unit) => sum + (unit.gpus?.length ?? 0), 0);
|
|
281
293
|
// One nvtop-style table across every unit; DEV is the unit index.
|
|
282
294
|
const mergedProcesses = liveUnits
|
|
283
|
-
.flatMap((unit) => (unit.processes ?? []).map((p) => ({
|
|
295
|
+
.flatMap((unit) => (unit.processes ?? []).map((p) => ({
|
|
296
|
+
...p,
|
|
297
|
+
unitIdx: unit.unitIdx,
|
|
298
|
+
utilReported: unit.perProcessUtil === true,
|
|
299
|
+
})));
|
|
284
300
|
return h('div', { className: 'nvtp-page' },
|
|
285
301
|
h('style', null, CSS),
|
|
286
302
|
h('h1', { className: 'nvtp-title' }, translate('panel')),
|
package/index.js
CHANGED
|
@@ -45,12 +45,13 @@ const SMI_TIMEOUT_MS = 5000;
|
|
|
45
45
|
const SSH_TIMEOUT_MS = 8000;
|
|
46
46
|
|
|
47
47
|
/** Marker names delimiting sections of the one-shot remote probe script. */
|
|
48
|
-
const REMOTE_SECTIONS = ['HOST', 'SMI', 'APPS', 'MEM'];
|
|
48
|
+
const REMOTE_SECTIONS = ['HOST', 'SMI', 'APPS', 'PMON', 'MEM'];
|
|
49
49
|
|
|
50
50
|
const REMOTE_PROBE = [
|
|
51
51
|
"printf '__NVTP_HOST__\\n'; hostname 2>/dev/null || echo unknown",
|
|
52
52
|
`printf '__NVTP_SMI__\\n'; nvidia-smi --query-gpu=${QUERY_FIELDS} --format=csv,noheader,nounits 2>/dev/null`,
|
|
53
53
|
`printf '__NVTP_APPS__\\n'; nvidia-smi --query-compute-apps=${APP_FIELDS} --format=csv,noheader,nounits 2>/dev/null`,
|
|
54
|
+
"printf '__NVTP_PMON__\\n'; nvidia-smi pmon -c 1 -s um 2>/dev/null",
|
|
54
55
|
"printf '__NVTP_MEM__\\n'; grep -E 'MemTotal|MemAvailable' /proc/meminfo 2>/dev/null",
|
|
55
56
|
].join('; ');
|
|
56
57
|
|
|
@@ -173,6 +174,41 @@ function parseAppsCsv(text) {
|
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Parse `nvidia-smi pmon -c 1` output into per-process utilisation rows.
|
|
179
|
+
*
|
|
180
|
+
* Each row is one (gpu, pid) context, so a process using several GPUs has one
|
|
181
|
+
* row per device. `sm` is the share of SM time the process used in the last
|
|
182
|
+
* sample window; `mem` is its memory-controller (bandwidth) utilisation. Both
|
|
183
|
+
* are null when the driver prints "-" (no activity / not reported).
|
|
184
|
+
* @internal exported for tests.
|
|
185
|
+
*/
|
|
186
|
+
function parsePmon(text) {
|
|
187
|
+
const rows = [];
|
|
188
|
+
for (const line of String(text ?? '').split('\n')) {
|
|
189
|
+
if (line.startsWith('#')) continue;
|
|
190
|
+
const match = line.trim().match(/^(\d+)\s+(\d+)\s+([CG])\s+(\S+)\s+(\S+)\s/);
|
|
191
|
+
if (match === null) continue;
|
|
192
|
+
rows.push({
|
|
193
|
+
device: Number(match[1]),
|
|
194
|
+
pid: Number(match[2]),
|
|
195
|
+
type: match[3],
|
|
196
|
+
sm: numeric(match[4]),
|
|
197
|
+
mem: numeric(match[5]),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return rows;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** Sample per-process utilisation; empty when the driver does not support pmon. */
|
|
204
|
+
async function samplePmon(runner) {
|
|
205
|
+
try {
|
|
206
|
+
return parsePmon(await runner(['pmon', '-c', '1', '-s', 'um']));
|
|
207
|
+
} catch {
|
|
208
|
+
return [];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
176
212
|
/**
|
|
177
213
|
* Parse MemTotal / MemAvailable from /proc/meminfo text.
|
|
178
214
|
* @internal exported for tests.
|
|
@@ -228,9 +264,11 @@ const PS_ARGS = ['-o', 'pid=,user=,%cpu=,rss=,args='];
|
|
|
228
264
|
* [N/A] because the GPU shares the LPDDR5X pool with the CPU. Following the
|
|
229
265
|
* sparkDash approach, `used` then comes from the compute-apps sum and `total`
|
|
230
266
|
* from the OS-visible pool (MemTotal), with MemAvailable as the free figure.
|
|
267
|
+
* @param pmon - `nvidia-smi pmon` rows of this unit; per-process SM utilisation
|
|
268
|
+
* when the driver reports it, otherwise an empty list.
|
|
231
269
|
* @internal exported for tests.
|
|
232
270
|
*/
|
|
233
|
-
function assembleUnit({ title, remote, gpusRaw, apps, mem, psDetails }) {
|
|
271
|
+
function assembleUnit({ title, remote, gpusRaw, apps, mem, psDetails, pmon = [] }) {
|
|
234
272
|
const poolTotalMib = mem.totalKib !== null ? mem.totalKib / 1024 : null;
|
|
235
273
|
const poolAvailMib = mem.availKib !== null ? mem.availKib / 1024 : null;
|
|
236
274
|
|
|
@@ -242,6 +280,10 @@ function assembleUnit({ title, remote, gpusRaw, apps, mem, psDetails }) {
|
|
|
242
280
|
}
|
|
243
281
|
|
|
244
282
|
const deviceOfUuid = new Map();
|
|
283
|
+
// pmon addresses devices by index; remember the index of each queried GPU uuid
|
|
284
|
+
// so a pmon row can be matched to the nvidia-smi gpu row it belongs to.
|
|
285
|
+
const uuidOfDevice = new Map();
|
|
286
|
+
const pmonSeen = new Set();
|
|
245
287
|
|
|
246
288
|
const gpus = gpusRaw.map((gpu) => {
|
|
247
289
|
const isSparkChip = /GB10|DGX\s*Spark/i.test(gpu.name ?? '');
|
|
@@ -274,6 +316,7 @@ function assembleUnit({ title, remote, gpusRaw, apps, mem, psDetails }) {
|
|
|
274
316
|
}
|
|
275
317
|
}
|
|
276
318
|
if (gpu.uuid !== '') deviceOfUuid.set(gpu.uuid, gpu.index);
|
|
319
|
+
uuidOfDevice.set(gpu.index, gpu.uuid);
|
|
277
320
|
return {
|
|
278
321
|
...gpu,
|
|
279
322
|
memoryUsed,
|
|
@@ -294,16 +337,36 @@ function assembleUnit({ title, remote, gpusRaw, apps, mem, psDetails }) {
|
|
|
294
337
|
name: app.name,
|
|
295
338
|
}));
|
|
296
339
|
|
|
340
|
+
// Per-process utilisation: a pmon row matches when both the pid and the
|
|
341
|
+
// device agree. The device check keeps a multi-GPU process from borrowing the
|
|
342
|
+
// SM figure it earned on another card.
|
|
343
|
+
const pmonKey = (device, pid) => `${device}:${pid}`;
|
|
344
|
+
const pmonRows = new Map();
|
|
345
|
+
for (const row of pmon) {
|
|
346
|
+
if (!uuidOfDevice.has(row.device)) continue;
|
|
347
|
+
const key = pmonKey(row.device, row.pid);
|
|
348
|
+
if (!pmonRows.has(key)) pmonRows.set(key, []);
|
|
349
|
+
pmonRows.get(key).push(row);
|
|
350
|
+
}
|
|
351
|
+
|
|
297
352
|
const processes = entries.map((entry) => {
|
|
298
353
|
const extra = psDetails.get(entry.pid);
|
|
299
354
|
const device = gpus.find((gpu) => gpu.index === entry.device);
|
|
355
|
+
const rows = entry.device === null
|
|
356
|
+
? []
|
|
357
|
+
: (pmonRows.get(pmonKey(entry.device, entry.pid)) ?? []);
|
|
358
|
+
const measured = rows.find((row) => row.sm !== null) ?? rows[0];
|
|
359
|
+
if (measured !== undefined) pmonSeen.add(pmonKey(entry.device, entry.pid));
|
|
300
360
|
return {
|
|
301
361
|
pid: entry.pid,
|
|
302
362
|
user: extra?.user ?? null,
|
|
303
363
|
device: entry.device,
|
|
304
|
-
//
|
|
305
|
-
type: 'C',
|
|
306
|
-
|
|
364
|
+
// pmon knows C (compute) and G (graphics); compute-apps only lists C.
|
|
365
|
+
type: measured?.type ?? 'C',
|
|
366
|
+
// This process's own SM utilisation on this device. Null means the driver
|
|
367
|
+
// did not report it: it must never fall back to the whole-GPU figure.
|
|
368
|
+
gpuUtilization: measured !== undefined ? measured.sm : null,
|
|
369
|
+
gpuMemUtilization: measured !== undefined ? measured.mem : null,
|
|
307
370
|
memoryUsed: entry.memoryUsed,
|
|
308
371
|
cpuPercent: extra?.cpu ?? null,
|
|
309
372
|
hostMemKib: extra?.rssKib ?? null,
|
|
@@ -311,15 +374,25 @@ function assembleUnit({ title, remote, gpusRaw, apps, mem, psDetails }) {
|
|
|
311
374
|
};
|
|
312
375
|
});
|
|
313
376
|
|
|
314
|
-
return {
|
|
377
|
+
return {
|
|
378
|
+
title,
|
|
379
|
+
remote,
|
|
380
|
+
gpus,
|
|
381
|
+
processes,
|
|
382
|
+
hostMem: mem,
|
|
383
|
+
// False when the driver gave no per-process figures at all, so the UI can
|
|
384
|
+
// say the GPU column is unavailable rather than silently showing zeros.
|
|
385
|
+
perProcessUtil: pmonSeen.size > 0,
|
|
386
|
+
};
|
|
315
387
|
}
|
|
316
388
|
|
|
317
389
|
async function sampleLocal() {
|
|
318
|
-
const [gpuText, appText, memText] = await Promise.all([
|
|
390
|
+
const [gpuText, appText, memText, pmon] = await Promise.all([
|
|
319
391
|
runSmi(['--query-gpu', QUERY_FIELDS, '--format=csv,noheader,nounits']),
|
|
320
392
|
runSmi(['--query-compute-apps', APP_FIELDS, '--format=csv,noheader,nounits'])
|
|
321
393
|
.catch(() => ''),
|
|
322
394
|
readFile('/proc/meminfo', 'utf8').catch(() => ''),
|
|
395
|
+
samplePmon((args) => runSmi(args)),
|
|
323
396
|
]);
|
|
324
397
|
const apps = parseAppsCsv(appText);
|
|
325
398
|
const psDetails = await processDetails(
|
|
@@ -333,6 +406,7 @@ async function sampleLocal() {
|
|
|
333
406
|
apps,
|
|
334
407
|
mem: parseMeminfo(memText),
|
|
335
408
|
psDetails,
|
|
409
|
+
pmon,
|
|
336
410
|
});
|
|
337
411
|
}
|
|
338
412
|
|
|
@@ -370,6 +444,7 @@ async function probePeer(peer) {
|
|
|
370
444
|
apps,
|
|
371
445
|
mem: parseMeminfo(sections.mem ?? ''),
|
|
372
446
|
psDetails,
|
|
447
|
+
pmon: parsePmon(sections.pmon ?? ''),
|
|
373
448
|
});
|
|
374
449
|
const complete = { id: peer.host, configuredTitle: peer.title ?? peer.host, ...unit };
|
|
375
450
|
if (complete.gpus.length === 0) {
|
|
@@ -511,6 +586,7 @@ export {
|
|
|
511
586
|
parseGpuCsv,
|
|
512
587
|
parseAppsCsv,
|
|
513
588
|
parseMeminfo,
|
|
589
|
+
parsePmon,
|
|
514
590
|
assembleUnit,
|
|
515
591
|
splitRemoteSections,
|
|
516
592
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-nvtop-panel",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "nvtop-style live GPU dashboard panel for the DeepSeek Harness (DSH) Web UI: per-GPU utilization/memory/temperature/power cards plus a full nvtop-like process table (PID, USER, DEV, TYPE, GPU, GPU MEM, CPU, HOST MEM, Command). DGX Spark (GB10) unified memory supported; daisy-chained units monitored over SSH.",
|