Skip to content

Windows/CUDA port: thermal gate, storage probe, correct dashboard stats#296

Open
David2024patton wants to merge 2 commits into
JustVugg:devfrom
David2024patton:dev-thermal
Open

Windows/CUDA port: thermal gate, storage probe, correct dashboard stats#296
David2024patton wants to merge 2 commits into
JustVugg:devfrom
David2024patton:dev-thermal

Conversation

@David2024patton

Copy link
Copy Markdown

Summary

Windows + CUDA portability pass so the engine and web dashboard run correctly on Windows with an NVIDIA GPU, plus a couple of small correctness fixes. Every change is guarded by #ifdef COLI_CUDA and cross-platform #ifdefs, so Linux/CPU behavior is unchanged.

Changes

Engine (c/glm.c)

  • NVML thermal heartbeat + thermal_gate() β€” a background thread samples GPU temperature (dynamically loaded nvml.dll / libnvidia-ml.so) and applies a proportional per-forward pause to bleed heat under sustained load. SAFE_MODE=0 disables it; if NVML is absent the engine proceeds normally.
  • Storage bus probe β€” probe_storage_drive() / storage_bus_is_slow() check free space and disk bus type via Win32 IOCTL_STORAGE_QUERY_PROPERTY and POSIX statvfs. FORCE_SLOW_DRIVE=1 bypasses.
  • Win32 hwinfo_emit branch β€” cores/RAM/CPU brand via GetSystemInfo / GlobalMemoryStatusEx / __get_cpuid, so the dashboard works without /proc.

Dashboard correctness

  • Report RAM and VRAM in binary GiB so 128 GiB / 16 GiB read as 128 / 16 instead of decimal 137 / 17 β€” matches the spec-sheet convention users expect.
  • Show the real GPU model via NVML nvmlDeviceGetName (e.g. NVIDIA GeForce RTX 4070 Ti SUPER) instead of a generic label. The web panel now displays the model name and labels the logical-processor count as threads.

Server (c/openai_server.py)

  • COLI_EBITS / COLI_DBITS env vars to select quant bit-width (needed for the 4-bit config on 16 GB GPUs). Absent β†’ engine defaults (8/8), i.e. upstream behavior preserved.

Testing

  • Built on Windows with MinGW gcc + nvcc/MSVC (CUDA 12.9), coli_cuda.dll unchanged.
  • Ran the full GLM-5.2 INT4 checkpoint end to end (COLI_CUDA=1 CUDA_DENSE=1 CUDA_EXPERT_GB=6 RAM_GB=110, 4-bit) with the web UI; /health reports ram_total_gb 127.7, vram_total_gb 16.0, gpu "NVIDIA GeForce RTX 4070 Ti SUPER", coherent generation, thermal + storage probes firing.

@JustVugg

Copy link
Copy Markdown
Owner

Thanks for this β€” the Windows dashboard stats overlap with #278 (hwinfo CPU/cores/RAM via CPUID + compat_meminfo), which just merged to main, so this now conflicts. The thermal gate + storage probe are still valuable and distinct. With "allow edits from maintainers" on I can rebase onto the current tree and drop whatever #278 already covers, so you don't have to untangle it β€” want me to? Otherwise a rebase on your side works too.

@ZacharyZcR's workflow, already green on dev (78c77bf): engine + C suite,
web build + vitest, python suite, and a real CUDA syntax check.

Only the workflow file is cherry-picked here β€” main's engine code stays at
54cfe56 and nothing else from dev comes along. main is where the checks are
worth the most and where they were missing entirely.

Includes the two fixes the first run exposed: the pinned action's version
table stops at 12.6.2 (12.6.3 failed the install), and `nvcc ... | head -40`
took its exit status from head, so the job could never fail.

Co-Authored-By: ZacharyZcR <JustVugg#144>

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@JustVugg

Copy link
Copy Markdown
Owner

Could you rewrite this against current dev? I'm keeping it open rather than closing it, but it can't land in its present shape.

It's 66 commits behind dev. On glm.c, which changes several times a day, that isn't a rebase β€” it's a rewrite, and doing it for you would mean rewriting your design decisions without understanding why you made them. So I'd rather ask.

Windows is now covered by CI on MSYS2/UCRT64, so a rebased version gets tested automatically β€” which is what this PR most lacked. Also check against #314 (build-config stamp, CUDA_HOME quoting), which may already cover part of your delta.

What changed under you, which makes a rewrite cheaper than it sounds:

What would help it land fast: the smallest version that does one thing. A 300–700 line PR touching glm.c needs a maintainer who can run it, and for most platforms here that maintainer doesn't exist. A focused change with a test the CI can execute gets reviewed in an hour.

If you'd rather not, say so and I'll close it with thanks β€” no hard feelings either way. And if you think I've misjudged and it should go in as-is, push back: I've been wrong twice today already and both times a contributor caught it.

Engine (c/glm.c), all guarded by #ifdef COLI_CUDA and cross-platform #ifdefs:

- NVML thermal heartbeat + thermal_gate() to bleed GPU heat per forward step (SAFE_MODE=0 disables); no-op when NVML is absent.

- probe_storage_drive()/storage_bus_is_slow(): Win32 IOCTL + POSIX statvfs disk bus/free-space probe (FORCE_SLOW_DRIVE=1 to bypass).

- Win32 hwinfo_emit branch (GetSystemInfo / GlobalMemoryStatusEx / __get_cpuid) so the dashboard works without /proc.

Dashboard correctness:

- Report RAM and VRAM in binary GiB so 128 GiB / 16 GiB read as 128 / 16 (not decimal 137 / 17).

- Show the real GPU model via NVML nvmlDeviceGetName (e.g. RTX 4070 Ti SUPER) instead of a generic label; web panel shows the name and labels the logical-processor count as threads.

Server (c/openai_server.py): COLI_EBITS/COLI_DBITS env to pick quant bit-width for 16 GB GPUs; absent preserves upstream 8/8 defaults.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants