Skip to content

Troubleshooting CUDA ​

Each entry is a symptom, its cause, and a solution. The messages are quoted from real failures.

The job always runs on the CPU ​

Symptomexplain() shows backend=cpu for a large dense job
Cause, most commonThe installed build has no CUDA support: a default install never does
SolutionRebuild with MENOS_ENABLE_CUDA=ON (CUDA Installation)

Other reasons the planner keeps a job on the CPU, all correct behaviour:

CauseHow to tell
The circuit is too small; launch overhead winsFewer than about 12 qubits
The plan is not a dense region (stabilizer, MPS, factorized, cut)strategy and engine in the report
The state does not fit in device memoryThe region needs more than the device's free memory
No usable GPU at run timenvidia-smi fails or shows no device
The CUDA candidate was slower by the calibrated modelCompare the two estimates

the provided PTX was compiled with an unsupported toolchain ​

SymptomThe first GPU job raises InternalError: cuda: cudaMemcpyToSymbol (matrix) failed: the provided PTX was compiled with an unsupported toolchain. (cudaError_t 222)
CauseThe package was built without CMAKE_CUDA_ARCHITECTURES, so the kernels were compiled for CMake's default architecture, not your GPU's. The driver then tries to recompile from PTX and cannot
SolutionReinstall with -DCMAKE_CUDA_ARCHITECTURES=<your compute capability without the dot> (for example 86). Find it with nvidia-smi --query-gpu=compute_cap --format=csv

cudaMalloc failed: out of memory ​

SymptomInternalError: cuda: cudaMalloc failed: out of memory
CauseSomething else claimed device memory after MENOS read the free figure, or the state is close to the budget
SolutionClose GPU-heavy applications, then retry; use fewer qubits; or run in a fresh process so the free figure is read again

nvcc or the toolkit is wrong ​

SymptomCMake reports an unexpected nvcc version or a host-compiler error such as the compiler being too new
CauseMore than one CUDA toolkit is installed and CMake picked the first nvcc on PATH
SolutionPass -DCMAKE_CUDA_COMPILER=/path/to/nvcc and -DCUDAToolkit_ROOT=/path/to/toolkit explicitly

The device looks wrong ​

SymptomThe device reports implausible properties, such as a single multiprocessor
CauseThe build compiled against one toolkit's headers and linked a different toolkit's runtime library
SolutionSet CUDAToolkit_ROOT to the toolkit you compile with, so the headers and the library agree

CUDA tests all skip in a sanitizer build ​

SymptomWith the cuda-dev preset, the test suite passes but no CUDA test actually ran
CauseAddressSanitizer's memory layout collides with the CUDA driver's address reservation, so the driver cannot initialize and every CUDA test skips
SolutionThe project's test presets set ASAN_OPTIONS=protect_shadow_gap=0. If you run the binary by hand, set it too

No GPU is detected ​

Symptomnvidia-smi fails or lists no device
CauseDriver not installed or not loaded, or no NVIDIA GPU
SolutionInstall the NVIDIA driver. MENOS is unaffected: it falls back to the CPU

Still stuck ​

Collect the output of nvidia-smi, the exact build command, and the plan report (explain()), and compare with CUDA Requirements.

Released under the Apache-2.0 license. GitHub · PyPI