Install: why each step is there
The commands are in README.md › Install. This page says why each
route is set up as it is, and what to do when a step fails.
With this repository’s Docker image
The host needs an R580 or newer driver, which CUDA 13.0 requires; on an older one CUDA says so by name. The image removes the CUDA forward-compatibility driver its base image ships, so the host’s own driver is always the one loaded.
--rm removes the container when you leave it, and with it the editable install, the plugins
and target files the first import cuqml installed into the container’s CUDA-Q, and the
compiled kernels: in each new container, run pip install -e . and
python -c "import cuqml" again, and the first call compiles the kernels again.
With pip
The package carries the engine, the kernels’ sources and the plugins’ source with the two
target files, and its first import builds and registers the targets, so the route needs no
clone of the repository. pip install git+https://github.com/OpenAQC/CuQML.git installs the
same package from the repository’s main branch instead of a release; it needs git. To work on
cuqml itself, clone it and pip install -e . in the clone, which takes the package’s place.
Install torch before cuqml: cuqml asks for torch, and with none installed yet, pip takes the
newest from PyPI rather than the cu130 build the pins were verified with.
The pins are the versions everything here was verified on, alongside CUDA-Q 0.16.0 (cu13),
g++ 13.3 and ninja 1.11. nvidia-cuda-nvcc has to be asked for and pinned: torch’s cu130
wheels carry the CUDA runtime and nvrtc but no compiler, and nvcc 13.3.x, the newest when
this was measured, is rejected by the 13.0.x toolkit headers torch pins. Its compiler parts,
nvidia-nvvm and nvidia-cuda-crt, are pinned to the same release: nvcc requires them with
no version, and nvvm 13.4.92, the newest when this was measured, emits PTX the 13.0 ptxas
rejects. python3-dev is there because the kernels and the plugins both compile against
Python’s headers; a conda, pyenv or uv Python carries its own.
In a CUDA container of your own
Here CUDA-Q comes from pip, and once import cuqml has run, the targets are reached exactly
as from CUDA-Q’s own image. cudaq is pinned to 0.16.0, the release this
route was verified on; a newer one is not verified here. A -devel image already carries nvcc
and the CCCL headers at its own CUDA version, so only CUTLASS’s CuTe headers come from pip:
the nvcc and CCCL pins of the pip route are for a runtime-only CUDA, which a
-devel image is not. python3-dev is there because the kernels and the plugins both
compile against Python’s headers. If every CUDA call then fails with error 804, on a GPU
without forward compatibility, the image’s forward-compatibility driver is newer than the
host’s: apt-get purge cuda-compat-13-0, as this repo’s image does.
What the build needs, and what it does
No environment variables, on any of these routes. The kernels are JIT-compiled at first
use, and the build finds its own toolchain — the CUDA root that holds nvcc, the CCCL and
CuTe headers, the libcudart the linker wants, and a job count that fits the host’s memory.
If something is genuinely missing, it says which.
The first import cuqml builds the NVQIR plugins, one per method and precision, and
installs them with their target files into CUDA-Q’s own tree, the one beside the cudaq
that Python imports: CUDA-Q reads targets from there alone. Until it has run, neither target
can be selected; and since CUDA-Q reads its targets once, when cudaq is imported, cuqml is
imported first. A stamp beside the target files records what they were built from and each
file as installed, and a later import builds them again only when CUDA-Q, cuqml or Python
has changed, or a file it installed has; each build says so on stderr, and two imports at
once build once, the second waiting and saying so. On a file system without locks, as Lustre
mounted with noflock, each says it has none and both may build; each stamp vouches only for
the files its own install wrote, so where two installs interleave the import that finds the
targets still stale says another build ran at the same time, and the next import builds them
again. Where the tree is
root-owned, as in CUDA-Q’s image, the install uses password-free or recently authenticated
sudo, sudo -n, which never asks for a password, and the line saying the build is done ends
“with sudo”. Without it, the import fails at once, naming the tree and the one command to
run, after each install or upgrade of cuqml or CUDA-Q, as a user who can write it.
The plugins compile against the NVQIR headers of the CUDA-Q they load into. Its container
image ships them; its pip wheel, from 0.16 on, does not, so the headers the plugins reach are
fetched from CUDA-Q’s source on GitHub, at the exact commit the installed CUDA-Q names, once,
into ~/.cache/cuqml. That needs network access the first time, and without it the import
says which URL it could not reach.