diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 12fe252..4357766 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9"] #, "3.10", "3.11"] + python-version: ["3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index fcd30b7..601b2e1 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,14 @@ The `pytorch/pytorch:2.2.1-cuda12.1-cudnn8-devel` docker [image](https://hub.doc ## Install ```bash -pip install git+https://github.com/PangeAI/simms +# Pick the extra matching your CUDA driver: cu12 or cu13 +pip install "simms[cu12] @ git+https://github.com/PangeAI/simms" ``` +The `cu12` / `cu13` extra installs the CUDA compiler pieces Numba needs (NVVM, libdevice) from pip, through [numba-cuda](https://github.com/NVIDIA/numba-cuda). Without an extra, Numba uses a CUDA toolkit installed on the system. + +The extra has to match the CUDA major version of your PyTorch build, which `python -c "import torch; print(torch.version.cuda)"` prints. PyTorch wheels on PyPI are built for CUDA 12 up to 2.10 and for CUDA 13 from 2.11, so in a fresh environment `cu12` resolves to PyTorch 2.10 and `cu13` to the newest PyTorch. If PyTorch is already installed, pick the extra that matches it, or pip may replace it. + ## Use with MatchMS ```py @@ -106,30 +111,28 @@ The **easiest way** to get started is to use the =0.24", - "torch>=2.0.0", + "numba>=0.61", + "numba-cuda>=0.30", + "numpy>=1.24", + "sparsestack>=0.5", + "torch>=2.4", "tqdm>=4.66.4", "joblib>=1.4.0", "requests>=2.31.0", @@ -23,6 +27,10 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] keywords = [ "similarity measures", @@ -32,6 +40,14 @@ keywords = [ "CUDA", ] +[project.optional-dependencies] +# NVVM, libdevice and the CUDA runtime from pip wheels, instead of a system or conda CUDA toolkit. +# cu12: cuda-core 1.3 refuses cuda-bindings < 12.9.8 at import, but PyTorch 2.10 (the last PyPI PyTorch built for +# CUDA 12) pins cuda-bindings 12.9.4; numba-cuda doesn't cap cuda-core, so cap it here until that clash is resolved. +cu12 = ["numba-cuda[cu12]>=0.30", "cuda-core<1.3"] +# cu13: PyPI PyTorch is built for CUDA 13 from 2.11 on; without the floor, pip can settle on an older, CUDA 12 PyTorch. +cu13 = ["numba-cuda[cu13]>=0.30", "torch>=2.11"] + [project.urls] homepage = "https://github.com/PangeAI/simms" repository = "https://github.com/PangeAI/simms" diff --git a/tests/similarity/test_matchms_compatibility.py b/tests/similarity/test_matchms_compatibility.py index 947fbe3..4a40ca2 100644 --- a/tests/similarity/test_matchms_compatibility.py +++ b/tests/similarity/test_matchms_compatibility.py @@ -6,8 +6,11 @@ BaseSimilarity, CosineGreedy, FingerprintSimilarity, - ModifiedCosine, ) +try: + from matchms.similarity import ModifiedCosine +except ImportError: # matchms >= 0.34 renamed it + from matchms.similarity import ModifiedCosineGreedy as ModifiedCosine from simms.similarity import ( CudaCosineGreedy, CudaFingerprintSimilarity, diff --git a/tests/stress/test_stress.py b/tests/stress/test_stress.py index ca45dbb..35a3c9e 100644 --- a/tests/stress/test_stress.py +++ b/tests/stress/test_stress.py @@ -2,7 +2,11 @@ import numpy as np import pytest from matchms.filtering import reduce_to_number_of_peaks -from matchms.similarity import CosineGreedy, ModifiedCosine +from matchms.similarity import CosineGreedy +try: + from matchms.similarity import ModifiedCosine +except ImportError: # matchms >= 0.34 renamed it + from matchms.similarity import ModifiedCosineGreedy as ModifiedCosine from matchms.similarity.BaseSimilarity import BaseSimilarity from sparsestack import StackedSparseArray from simms.similarity import CudaCosineGreedy, CudaModifiedCosine