Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,30 +111,28 @@ The **easiest way** to get started is to use the <a target="_blank" href="https:

For local installations, we recommend using [`micromamba`](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html), it is much faster.

Total size of install in a fresh conda environment will be around 7-8GB (heaviest packages are `pytorch`, and `cudatoolkit`).
SimMS needs Python 3.11–3.14. Total size of install will be around 7-8GB (heaviest packages are `pytorch` and the CUDA libraries).

```bash
# Install cudatoolkit
conda install nvidia::cuda-toolkit -y

# Install torch (follow the official guide https://pytorch.org/get-started/locally/#start-locally)
conda install pytorch -c pytorch -c nvidia -y

# Install numba (follow the offical guide: https://numba.pydata.org/numba-doc/latest/user/installing.html#installing-using-conda-on-x86-x86-64-power-platforms)
conda install numba -y
# Install torch for your CUDA version (follow the official guide https://pytorch.org/get-started/locally/#start-locally)
pip install torch

# Install this repository
pip install git+https://github.com/PangeAI/simms
# Install this repository, with the CUDA pieces for Numba from pip: the extra matching torch.version.cuda (cu12 or cu13)
pip install "simms[cu13] @ git+https://github.com/PangeAI/simms"
```

With conda, install `cuda-toolkit` and `numba-cuda` from conda-forge instead of using the extra.

## Run in docker

The `pytorch/pytorch:2.2.1-cuda12.1-cudnn8-devel` has nearly everything you need. Once inside, do:
The `pytorch/pytorch:2.4.1-cuda12.4-cudnn9-devel` image (Python 3.11) has nearly everything you need. Once inside, do:

```sh
pip install git+https://github.com/PangeAI/simms
pip install "simms[cu12] @ git+https://github.com/PangeAI/simms"
```

Older images need care: `pytorch/pytorch:2.2.1-cuda12.1-cudnn8-devel` ships PyTorch built against NumPy 1, which current releases of SimMS's dependencies replace with NumPy 2.

## Run on vast.ai

Use [this template](https://cloud.vast.ai/?ref_id=51575&template_id=f45f6048db515291bda978a34e908d09) as a starting point, once inside, simply do:
Expand Down
20 changes: 18 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ authors = [
]
readme = "README.md"
license = "MIT"
requires-python = ">=3.8,<3.13"
requires-python = ">=3.11,<3.15"
dependencies = [
"matchms>=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",
Expand All @@ -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",
Expand All @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion tests/similarity/test_matchms_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion tests/stress/test_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading