Repository navigation
Conversation
…atchms 0.34 - requires-python >=3.10,<3.14 (was >=3.8,<3.13): numba >= 0.61 needs 3.10. - numba >= 0.61 and numba-cuda as dependencies. Numba's built-in CUDA target is deprecated in favour of NVIDIA's numba-cuda, which numba >= 0.61 uses automatically; numba 0.59's built-in driver bindings segfault creating a context on recent drivers. Extras cu12 / cu13 install NVVM and libdevice from pip. - numpy and sparsestack declared: SimMS imports both directly. - Tests: matchms 0.34 renamed ModifiedCosine to ModifiedCosineGreedy; import either. - CI tests Python 3.10, 3.11, 3.12 and 3.13 (was 3.9 only). - README: pip install with the CUDA extra; a current PyTorch image for Docker.
…A 11 PyTorch; say the extra must match torch's CUDA
…s 12.9.4), require PyTorch 2.11+ for cu13
Collaborator
|
Thank you so much for this thorough dependency & CUDA investigation, @BioGeek! We incorporated your Python 3.11–3.14, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SimMS currently declares
requires-python = ">=3.8,<3.13"and leaves Numba to whatever matchms pulls in. On a current GPU node that combination either doesn't install or crashes. This PR:numba>=0.61andnumba-cuda>=0.30. Numba's built-in CUDA target is deprecated in favour of NVIDIA's numba-cuda, which Numba ≥ 0.61 picks up automatically. The old built-in driver bindings segfaulted for me on a current driver (see below).cu12/cu13install NVVM and libdevice from pip, throughnumba-cuda[cu12]/[cu13]. A condacudatoolkitis no longer required.cu12capscuda-corebelow 1.3 (see step 9).cu13requires PyTorch 2.11 or newer, the first PyPI release built for CUDA 13 (see step 10).cu12extra can't resolve to a CUDA 11 PyTorch (see step 8 below).numpyandsparsestack, which SimMS imports directly but only got through matchms.ModifiedCosinetoModifiedCosineGreedy. Two test modules now import either name. SimMS's own code is unaffected.What went wrong getting SimMS running
I needed SimMS on an H100 node of a Kubernetes cluster (current NVIDIA driver), from a Docker image. In order:
Python 3.13 is excluded. Our project image is Python 3.13, and
requires-python <3.13stops pip. So I followed the README and built a separate image frompytorch/pytorch:2.2.1-cuda12.1-cudnn8-devel(Python 3.10).Importing SimMS failed in that image.
pip install simmspulled the latest networkx through matchms, and on the image's Python 3.10import networkxraised aSyntaxErrorinsidenetworkx/utils/configs.py(a dataclass built from the backend namenx-loopback). Sofrom simms.similarity import ...failed before any SimMS code ran. Fix in the image:networkx<3.4.NumPy 2 against PyTorch 2.2. Current releases pull NumPy 2, and the image's PyTorch 2.2 is built against NumPy 1. Fix in the image:
numpy<2.Segfault on the GPU. With those pins, the process died silently right after Numba's CUDA driver logged
init. Withpython -X faulthandler, the trace showed a segmentation fault innumba/cuda/cudadrv/driver.py(safe_cuda_api_call), while creating a CUDA context to compile the kernel:CudaCosineGreedy.__init__→cosine_kernel→cuda.jit→get_current_device. PyTorch had already used the same GPU without trouble. With those pins, the resolver had picked matchms 0.27.0 and Numba 0.59.1, so this was Numba's old built-in ctypes driver binding against a much newer driver.Numba ≥ 0.61 doesn't resolve with those pins. Adding
numba>=0.61andnumba-cuda[cu12]to thenumpy<2andnetworkx<3.4pins on 3.10 is unsatisfiable: the matchms releases compatible with those pins each cap Numba (numba<0.57.1,==0.60.*, …). Without the pins, newer matchms and Numba resolve, but then the old PyTorch image breaks (step 3). The way out is a newer Python and PyTorch.Python 3.11 resolves cleanly: matchms 0.34.0, numba 0.68.1, numba-cuda 0.30.4, NumPy 2, PyTorch 2.4.1 (
pytorch/pytorch:2.4.1-cuda12.4-cudnn9-devel). SimMS's simulator tests pass there, and on the H100 (driver 580.105.08) it works: Numba detects the GPU as supported, the kernel compiles in about 2 s, a self-similarity probe scores 1.0, and a search over 550k spectra ran at about 30 s per 400k-spectrum file.matchms 0.34 renamed
ModifiedCosine. That broketests/similarity/test_matchms_compatibility.pyandtests/stress/test_stress.pyat import.pip install simms[cu12]in a fresh environment resolved PyTorch 2.0.1. Testing this branch from scratch on the H100, pip pickedtorch==2.0.1with CUDA 11.7 wheels. That build has no kernels for the H100 (CUDA error: no kernel image is available) and isn't compatible with NumPy 2, so 40 GPU tests failed.The cause is the CUDA major version. Recent PyTorch wheels on PyPI depend on CUDA 13 libraries, while the
cu12extra brings numba-cuda's CUDA 12 toolkit. pip backtracked through PyTorch releases until it found one whose CUDA 11 wheels don't clash.With
torch>=2.4declared, the same install resolves PyTorch 2.10.0 (CUDA 12.8), and[cu13]resolves PyTorch 2.15.0 (CUDA 13.2). The README now says the extra has to matchtorch.version.cuda.Then
cu12installed but couldn't import.cuda-core1.3.0 (released 2026-11-11), which numba-cuda pulls in without an upper bound, refuses at import:cuda.core 1.3.0 requires cuda-bindings >= 12.9.8 for CUDA 12, but cuda-bindings 12.9.4 is installed.cuda-bindings==12.9.4.cuda-coredeclares itscuda-bindingsfloor only under its owncu12extra, which nothing requests, so pip installs the clashing pair without complaint.cuda-corerelease accepts any 12.x bindings. Thecu12extra capscuda-core<1.3until the clash is resolved upstream.And
cu13resolved a CUDA 12 PyTorch.nvJitLinkError: ERROR_INTERNAL("may need newer version of nvJitLink library").torch>=2.11in thecu13extra it resolves PyTorch 2.15.0+cu132 and passes.Steps 2–5 and 8–10 are what this PR prevents: declared dependency floors that resolve to a working Numba/CUDA stack on every supported Python, and a supported way to get NVVM from pip.
Testing
NUMBA_ENABLE_CUDASIM=1 pytest -m github_ci(the CI selection), with the resolved versions:Rerun on all four Python versions in the new CI matrix (3.11, 3.12, 3.13, 3.14), with the CI job's steps: flake8's strict selection passes and
pytest -m github_cigives 24 passed on each.On a real GPU: an H100, driver 580.105.08, Python 3.11. Each extra was installed in a fresh venv with
pip install "simms[<extra>] @ git+https://github.com/BioGeek/SimMS@3031b95"and nothing else pinned, then the full test suite ran without the simulator:tests/similarity+tests/usecasetests/stresscu12cu13Merged with the peak-array PR, on PyTorch 2.4.1+cu124, numba 0.68.1 and numba-cuda[cu12] 0.30.4: 45 passed, plus 8 in
tests/stress.Notes for review
numba-cuda>=0.30is the version I tested. Older numba-cuda releases may work, but I haven't checked them..github/workflows/docker-image.ymlbuilds--file Dockerfile, but the repository has noDockerfile, so that workflow would fail on a release. I left it alone, it's out of scope here.