Skip to content

docs(guide): guide/GPU.md — the build recipe cli_build already knows - #1871

Closed
adeerkhan wants to merge 1 commit into
bendlang:mainfrom
adeerkhan:docs/gpu-build-recipe
Closed

adeerkhan wants to merge 1 commit into
bendlang:mainfrom
adeerkhan:docs/gpu-build-recipe

Conversation

@adeerkhan

Copy link
Copy Markdown
Contributor

Closes #1863

What

A new guide/GPU.md (readable as bend guide gpu, the same way bend guide shaders works) that spells out, in user-facing words, what until now lived only in cli_build's comment in bend2/main.ts:

  1. Finding a toolkit — the search order ($CUDA_HOME, $CUDA_PATH, /usr/local/cuda, /opt/cuda) and include/nvrtc.h as the marker file; a user-unpacked toolkit works.
  2. What the build does — -DBEND_CUDA=1, -I/-L/-lcuda -lnvrtc (lib64 first, lib as nix lays them), and the +RTS --gpu-build run that writes file.gpu beside the binary.
  3. Running it — the loader needs libcuda.so.1 and libnvrtc.so.13; with an unpacked toolkit, LD_LIBRARY_PATH=$CUDA_HOME/lib64 or the binary dies with libnvrtc.so.13: cannot open shared object file; --gpu off / --gpu 4GB.
  4. Which lane ran — the part that was fully invisible: with no toolkit the build succeeds silently on the CPU lane, and ldd file | grep -E 'cuda|nvrtc' is how you tell.

guide/GUIDE.md's Tooling sentence now points at bend guide gpu (net smaller than before, so GUIDE.md stays under its permanent 8k cap), and GPU.md joins EFFECTS.md/SHADERS.md on gates/repo.ts's allow list, uncapped like them.

Checks

The optional half of #1863 — having the build itself print one line when it falls back to the CPU — is deliberately not in this PR (it changes compiler output); happy to send it separately if wanted.

…endlang#1863)

The CUDA search order, nvrtc.h as the marker, lib64/lib, the +RTS --gpu-build step, the runtime loader, and that a missing toolkit silently builds the CPU lane (ldd says which lane a binary got). GUIDE.md's Tooling sentence keeps its size under the permanent cap and points at 'bend guide gpu'; GPU.md joins EFFECTS/SHADERS on the allow list.
@Lorenzobattistela

Copy link
Copy Markdown
Collaborator

Thanks for writing this up, and for the BendTorch repro. We're closing this one: a new guide page is more than this content needs, and it documents the symptom rather than fixing it. The real problem is that a ! program with no CUDA toolkit builds silently for the CPU. We're fixing that in the build itself in #1888, so it tells you when no toolkit was found instead of falling back quietly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants