simms-gpu 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simms_gpu-1.0.0/LICENSE +20 -0
- simms_gpu-1.0.0/PKG-INFO +225 -0
- simms_gpu-1.0.0/README.md +186 -0
- simms_gpu-1.0.0/pyproject.toml +102 -0
- simms_gpu-1.0.0/simms/__init__.py +6 -0
- simms_gpu-1.0.0/simms/__version__.py +1 -0
- simms_gpu-1.0.0/simms/peaks.py +174 -0
- simms_gpu-1.0.0/simms/similarity/CudaBinnedEmbeddingSimilarity.py +103 -0
- simms_gpu-1.0.0/simms/similarity/CudaCosineGreedy.py +230 -0
- simms_gpu-1.0.0/simms/similarity/CudaCosineLinear.py +382 -0
- simms_gpu-1.0.0/simms/similarity/CudaEntropyGreedy.py +184 -0
- simms_gpu-1.0.0/simms/similarity/CudaFingerprintSimilarity.py +207 -0
- simms_gpu-1.0.0/simms/similarity/CudaModifiedCosine.py +10 -0
- simms_gpu-1.0.0/simms/similarity/CudaNeutralLossesCosine.py +23 -0
- simms_gpu-1.0.0/simms/similarity/CudaTransitiveAlignment.py +295 -0
- simms_gpu-1.0.0/simms/similarity/__init__.py +24 -0
- simms_gpu-1.0.0/simms/similarity/_base.py +178 -0
- simms_gpu-1.0.0/simms/similarity/_transitive_peaks.py +270 -0
- simms_gpu-1.0.0/simms/similarity/spectrum_similarity_functions.py +312 -0
- simms_gpu-1.0.0/simms/similarity/vector_similarity_functions.py +202 -0
- simms_gpu-1.0.0/simms/utils.py +126 -0
simms_gpu-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2012-2024 Pangea Botanica Ltd.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
simms_gpu-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: simms-gpu
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Faster Similarity for Mass Spec on GPU
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: similarity measures,mass spectrometry,fuzzy matching,fuzzy search,CUDA
|
|
8
|
+
Author: Tornike Onoprishvili
|
|
9
|
+
Author-email: tornikeonoprishvili@gmail.com
|
|
10
|
+
Requires-Python: >=3.11,<3.15
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Natural Language :: English
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Provides-Extra: cu12
|
|
18
|
+
Provides-Extra: cu13
|
|
19
|
+
Provides-Extra: fingerprints
|
|
20
|
+
Requires-Dist: chemap (>=0.3.9) ; extra == "fingerprints"
|
|
21
|
+
Requires-Dist: cuda-core (<1.3) ; extra == "cu12"
|
|
22
|
+
Requires-Dist: joblib (>=1.4.0)
|
|
23
|
+
Requires-Dist: matchms (>=1.0.0,<2.0.0)
|
|
24
|
+
Requires-Dist: numba (>=0.61)
|
|
25
|
+
Requires-Dist: numba-cuda (>=0.30)
|
|
26
|
+
Requires-Dist: numba-cuda[cu12] (>=0.30) ; extra == "cu12"
|
|
27
|
+
Requires-Dist: numba-cuda[cu13] (>=0.30) ; extra == "cu13"
|
|
28
|
+
Requires-Dist: numpy (>=2.0,<2.5)
|
|
29
|
+
Requires-Dist: requests (>=2.31.0)
|
|
30
|
+
Requires-Dist: scipy (>=1.11)
|
|
31
|
+
Requires-Dist: torch (>=2.11) ; extra == "cu13"
|
|
32
|
+
Requires-Dist: torch (>=2.4.0)
|
|
33
|
+
Requires-Dist: tqdm (>=4.66.4)
|
|
34
|
+
Project-URL: Bug Tracker, https://github.com/PangeAI/simms/issues
|
|
35
|
+
Project-URL: Homepage, https://github.com/PangeAI/simms
|
|
36
|
+
Project-URL: Repository, https://github.com/PangeAI/simms
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# SimMS
|
|
40
|
+
|
|
41
|
+
SimMS compares tandem mass spectra on an NVIDIA GPU using the scoring algorithms in matchms 1.0.0. A score matrix has one row per reference and one column per query. Peak-matching cosine methods also return the number of assigned peaks.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
The PyPI distribution is `simms-gpu`. Import it in Python as `simms`. Use Python 3.11 through 3.14, an NVIDIA driver compatible with your CUDA runtime and a CUDA-enabled build of PyTorch for that runtime. Choose the matching wheel with the [PyTorch installation selector](https://pytorch.org/get-started/locally/).
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# CUDA 12, in an environment with a matching CUDA 12 PyTorch build
|
|
49
|
+
pip install "simms-gpu[cu12]"
|
|
50
|
+
|
|
51
|
+
# CUDA 13
|
|
52
|
+
pip install "simms-gpu[cu13]"
|
|
53
|
+
|
|
54
|
+
# Include chemap for generating molecular fingerprints
|
|
55
|
+
pip install "simms-gpu[cu13,fingerprints]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For CUDA 12 fingerprints, use `simms-gpu[cu12,fingerprints]`. The CUDA extras supply the numba-cuda compiler and runtime dependencies. Check PyTorch with `python -c "import torch; print(torch.version.cuda, torch.cuda.is_available())"` before running on the GPU.
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
This example loads the GNPS pesticide library and ranks references for the first query. Both collections use the same m/z grid. One-shot MGF iterators can also be passed directly to `calculate_scores`, `matrix`, `sparse_matrix`, or `PeakArrays.from_spectra`. With `CosineGreedy` defaults, each spectrum needs a positive finite precursor m/z for precursor removal.
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import numpy as np
|
|
66
|
+
from matchms import Scores, SpectraCollection, calculate_scores
|
|
67
|
+
from matchms.importing import load_from_mgf
|
|
68
|
+
from simms.similarity import CudaCosineGreedy
|
|
69
|
+
from simms.utils import download
|
|
70
|
+
|
|
71
|
+
spectra = list(load_from_mgf(download("pesticides.mgf")))
|
|
72
|
+
refs = SpectraCollection(spectra[:40])
|
|
73
|
+
queries = SpectraCollection(spectra[40:])
|
|
74
|
+
sim = CudaCosineGreedy()
|
|
75
|
+
scores = calculate_scores(spectra_1=refs, spectra_2=queries, similarity_function=sim)
|
|
76
|
+
assert isinstance(scores, Scores)
|
|
77
|
+
|
|
78
|
+
query_scores = scores.to_array("score")[:, 0]
|
|
79
|
+
matches = scores.to_array("matches")[:, 0]
|
|
80
|
+
for i in np.argsort(-query_scores, kind="stable")[:5]:
|
|
81
|
+
print(i, query_scores[i], matches[i])
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For an all-against-all comparison use `sim.matrix(refs)`. To reuse padded peak arrays and keep the output on the GPU, use the same scorer directly.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from simms import PeakArrays
|
|
88
|
+
|
|
89
|
+
left = PeakArrays.from_spectra(refs)
|
|
90
|
+
right = PeakArrays.from_spectra(queries)
|
|
91
|
+
planes = sim.matrix(left, right, array_type="torch")
|
|
92
|
+
best_ref_per_query = planes[0].argmax(dim=0)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The default cosine tensor has shape `(2, n_refs, n_queries)`, with score and matches in that order. Scalar methods return a two-dimensional tensor. `batch_size` limits each tile axis. A dense Torch result still needs enough device memory for the entire output.
|
|
96
|
+
|
|
97
|
+
## GPU similarities
|
|
98
|
+
|
|
99
|
+
| SimMS class | matchms 1.0.0 counterpart | What it compares |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| `CudaCosineGreedy` | `CosineGreedy` | One-to-one fragment matches ranked by weighted intensity product |
|
|
102
|
+
| `CudaModifiedCosineGreedy` | `ModifiedCosineGreedy` | Direct and precursor-shifted candidates in a shared assignment |
|
|
103
|
+
| `CudaNeutralLossesCosine` | `NeutralLossesCosine` | Precursor-shifted fragment matches |
|
|
104
|
+
| `CudaEntropyGreedy` | `EntropyGreedy` | Entropy-weighted fragment, neutral-loss or hybrid matches |
|
|
105
|
+
| `CudaCosineLinear` | `CosineLinear` | Linear fragment matching after merging nearby peaks |
|
|
106
|
+
| `CudaModifiedCosineLinear` | `ModifiedCosineLinear` | Linear matching with a precursor shift and conflict resolution |
|
|
107
|
+
| `CudaBinnedEmbeddingSimilarity` | `BinnedEmbeddingSimilarity` | Cosine or Euclidean similarity of binned intensities |
|
|
108
|
+
| `CudaFingerprintSimilarity` | `FingerprintSimilarity` | Tanimoto or cosine over molecular fingerprints |
|
|
109
|
+
|
|
110
|
+
`CudaModifiedCosine` is an alias for `CudaModifiedCosineGreedy`. Fingerprint matrices are indexed by valid unique compounds, in matchms `Fingerprints.inchikeys` order on each axis. Use a chemap-compatible generator with valid InChIKey and SMILES or InChI metadata, or pass prepared containers as `fingerprints_1` and `fingerprints_2`. A precursor mask for fingerprint scoring must use those same compound axes. A spectrum-level mask is directly reusable when each spectrum represents a different valid compound on its axis. RDKit generators with JSON support can be exported through `to_dict()` and reconstructed from the saved parameters. Embedding, entropy and fingerprint scorers return a single score field.
|
|
111
|
+
|
|
112
|
+
Binned embeddings and precomputed fingerprints also run on CPU. The six spectral CUDA scorers require a CUDA device or the Numba simulator. For simulator tests, set `NUMBA_ENABLE_CUDASIM=1` before starting Python.
|
|
113
|
+
|
|
114
|
+
## Transitive alignment
|
|
115
|
+
|
|
116
|
+
`CudaTransitiveAlignment` builds an undirected network from one collection of spectra. Its defaults retain direct modified-cosine edges with a score of at least 0.7 and at least six matches. Each reachable non-edge uses the fewest-hop path with the highest sum of direct scores. Set `max_hops` to limit path length. [Wang et al., JASMS 2024](https://doi.org/10.1021/jasms.4c00208)
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from simms.similarity import CudaTransitiveAlignment
|
|
120
|
+
|
|
121
|
+
aligner = CudaTransitiveAlignment()
|
|
122
|
+
result = aligner.align(spectra, return_peak_pairs=True)
|
|
123
|
+
bridges = result.to_scores(sparse=True, transitive_only=True)
|
|
124
|
+
for edge in result.transitive_edges:
|
|
125
|
+
key = (edge.row, edge.col)
|
|
126
|
+
print(edge.score, result.paths[key], result.peak_pairs[key])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The aligner is available by explicit import. `simms.similarity.__all__` lists the pairwise scorers. Use `aligner.sparse_matrix(spectra, min_score=0.8)` to filter the final edges after path selection.
|
|
130
|
+
|
|
131
|
+
Pass `base_scores=...` to `align`, `matrix`, or `sparse_matrix` to reuse dense or sparse direct scores with both `score` and `matches` fields. Use the same spectrum order and preprocessing as the original calculation. Paths use input spectrum indices. Peak pairs use zero-based indices after precursor and noise filtering. The score matrices store edges symmetrically with a zero diagonal. Use `result.to_dict()` to serialize the paths and evidence to JSON.
|
|
132
|
+
|
|
133
|
+
## RTX 4060 Laptop benchmark
|
|
134
|
+
|
|
135
|
+
Each row compares 1,024 references with 1,024 disjoint queries on an Intel Core i9-14900HX and an 8 GB RTX 4060 Laptop GPU. The inputs are the first eligible spectra in file order from GNPS-random-10k, with nonempty peaks and positive finite precursor m/z. The fingerprint rows use two disjoint sets of 1,024 unique compounds from the same file, encoded once with RDKit Morgan radius 2, 2,048 bits and matchms/chemap.
|
|
136
|
+
|
|
137
|
+
Times are seconds for one warmed dense `matrix` call, using matchms 1.0.0 defaults unless indicated. They include spectrum preparation, device transfers and host output. MGF parsing, fingerprint generation and JIT warmup are excluded. GPU tile size was 256. Flash times include building its CPU index, with the default worker count. Speedup uses the named CPU counterpart. VRAM is peak process memory sampled with NVML every 5 ms, including the CUDA context and allocator caches retained across cases. The JSON also records PyTorch's peak allocated bytes in MiB.
|
|
138
|
+
|
|
139
|
+
| Method and settings | matchms CPU (s) | SimMS GPU (s) | Speedup | Flash CPU (s) | Max abs. score difference | Count mismatches | VRAM (MiB) |
|
|
140
|
+
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
|
141
|
+
| CosineGreedy | 36.148 | 0.285 | 126.73× | 0.059 | 0 | 0 | 1600 |
|
|
142
|
+
| CosineGreedy 0.5 Da | 39.004 | 0.308 | 126.47× | 0.069 | 0 | 0 | 1600 |
|
|
143
|
+
| CosineGreedy 0.5 Da mz_power=1.0 | 39.699 | 0.315 | 125.95× | n/a | 0 | 0 | 1600 |
|
|
144
|
+
| ModifiedCosineGreedy | 39.709 | 0.286 | 138.75× | n/a | 0 | 0 | 1600 |
|
|
145
|
+
| NeutralLossesCosine | 35.542 | 0.278 | 127.92× | n/a | 0 | 0 | 1600 |
|
|
146
|
+
| EntropyGreedy fragment | 80.557 | 0.103 | 784.89× | 0.068 | 4.44e-16 | n/a | 1600 |
|
|
147
|
+
| EntropyGreedy hybrid | 100.485 | 0.153 | 655.12× | 0.074 | 4.44e-16 | n/a | 1600 |
|
|
148
|
+
| CosineLinear | 3.389 | 0.074 | 46.01× | n/a | 0 | 0 | 1600 |
|
|
149
|
+
| ModifiedCosineLinear | 4.136 | 0.101 | 40.86× | n/a | 0 | 0 | 1600 |
|
|
150
|
+
| BinnedEmbeddingSimilarity float64 | 0.070 | 0.056 | 1.25× | n/a | 2.33e-15 | n/a | 1620 |
|
|
151
|
+
| BinnedEmbeddingSimilarity float32 | 0.071 | 0.037 | 1.89× | n/a | 4.61e-07 | n/a | 1620 |
|
|
152
|
+
| FingerprintSimilarity tanimoto | 0.042 | 0.048 | 0.88× | n/a | 2.96e-08 | n/a | 1640 |
|
|
153
|
+
| FingerprintSimilarity cosine | 0.033 | 0.064 | 0.51× | n/a | 7.38e-08 | n/a | 1640 |
|
|
154
|
+
|
|
155
|
+
Every cosine peak-matching row agreed on all 1,048,576 scores and counts. Entropy, embedding and fingerprint methods return scores only. Fingerprint CPU computations use float32 inputs, which accounts for small differences against the FP64 GPU calculation.
|
|
156
|
+
|
|
157
|
+
**Choosing an implementation.** For default fragment cosine or fragment/hybrid entropy on this GNPS slice, the CPU Flash implementations finished first. CosineFlash also led at 0.5 Da. Its interface supports intensity weighting but has no `mz_power` parameter. Use GPU greedy cosine when you need that weighting, or when later operations can consume the device tensor. For repeated searches against a fixed library, matchms can reuse a Flash index. Flash has its own matching conventions, so the parity columns above compare SimMS with the named CPU oracle. For precomputed Morgan fingerprints at this size, the CPU won both comparisons.
|
|
158
|
+
|
|
159
|
+
**Device-resident output.** With prepacked `PeakArrays`, `CudaCosineGreedy` produced a `(2, 4096, 2048)` FP64 CUDA tensor in 2.044 s, or **4.10 million pairs/s**. The timer excludes initial array construction and includes scoring through CUDA synchronization. Sampled process VRAM peaked at 1,768 MiB, with 137.36 MiB of live PyTorch allocations at their peak.
|
|
160
|
+
|
|
161
|
+
To reproduce on Linux with a CUDA GPU, run these commands from the checkout. Use `--mgf tests/data/pesticides.mgf --size 32 --demo-rows 48 --demo-cols 24` for a smaller run against the bundled file, with `--output /tmp/pesticides.json` to keep its results separate.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
python -m pip install -e ".[cu13,fingerprints]" nvidia-ml-py
|
|
165
|
+
NUMBA_CUDA_LOW_OCCUPANCY_WARNINGS=0 python benchmarks/benchmark_matchms.py
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The full-precision results include the dataset SHA-256, software versions, timings and peak memory for each row. [Benchmark script](benchmarks/benchmark_matchms.py) · [Measured results](benchmarks/rtx4060.json)
|
|
169
|
+
|
|
170
|
+
## Multi-GPU Validation & Scaling
|
|
171
|
+
|
|
172
|
+
Both GPUs ran the same `simms-gpu 1.0.0` wheel in fresh Python 3.12 environments. The wheel smoke test exercised all nine GPU scorers. All 13 dense matchms comparisons met the [RTX 4060 benchmark](#rtx-4060-laptop-benchmark) parity tolerances, and the 1,024-spectrum transitive alignment matched the CPU reference exactly on both GPUs.
|
|
173
|
+
|
|
174
|
+
| GPU | Architecture | Wheel extras | PyTorch / CUDA runtime | Pytest | Transitive alignment, warm GPU / CPU (s) |
|
|
175
|
+
|---|---|---|---:|---:|---:|
|
|
176
|
+
| [NVIDIA GeForce RTX 4090](benchmarks/vast_rtx_4090.json) | Ada Lovelace | `cu12,fingerprints` | 2.10.0 / 12.8 | 341/341 | 0.102 / 17.47 |
|
|
177
|
+
| [NVIDIA A100-SXM4-80GB](benchmarks/vast_a100_sxm4.json) | Ampere | `cu13,fingerprints` | 2.15.0 / 13.2 | 341/341 | 0.097 / 32.97 |
|
|
178
|
+
|
|
179
|
+
Each cell gives **million pairs/s / peak process VRAM (MiB)** for one warmed call with prepacked FP64 `PeakArrays` and tile size 256. Torch returns a dense device tensor. Sparse applies `min_score=0.7` on the GPU and returns the retained coordinates and scores on the host. Throughput counts every evaluated pair. NVML samples process memory every 5 ms, including the CUDA context and allocator caches.
|
|
180
|
+
|
|
181
|
+
| Scorer | Output | RTX 4090, 4,096 × 2,048 | A100, 4,096 × 2,048 | RTX 4090, 9,000 × 2,048 | A100, 9,000 × 2,048 |
|
|
182
|
+
|---|---|---:|---:|---:|---:|
|
|
183
|
+
| `CudaCosineGreedy` | Torch | 11.24 / 8,480 | 11.22 / 9,502 | 11.04 / 9,110 | 11.27 / 10,132 |
|
|
184
|
+
| `CudaCosineGreedy` | Sparse | 11.08 / 8,544 | 11.11 / 9,566 | 10.40 / 9,252 | 11.02 / 10,274 |
|
|
185
|
+
| `CudaModifiedCosineGreedy` | Torch | 10.80 / 8,544 | 10.79 / 9,566 | 10.05 / 9,534 | 10.68 / 10,556 |
|
|
186
|
+
| `CudaModifiedCosineGreedy` | Sparse | 10.67 / 8,546 | 10.60 / 9,568 | 9.87 / 9,534 | 10.61 / 10,556 |
|
|
187
|
+
| `CudaEntropyGreedy` | Torch | 34.11 / 8,546 | 24.51 / 9,568 | 37.39 / 9,534 | 25.59 / 10,556 |
|
|
188
|
+
| `CudaEntropyGreedy` | Sparse | 31.83 / 8,546 | 22.22 / 9,568 | 34.67 / 9,534 | 24.32 / 10,556 |
|
|
189
|
+
| `CudaCosineLinear` | Torch | 54.45 / 8,546 | 36.42 / 9,568 | 57.96 / 9,534 | 38.04 / 10,556 |
|
|
190
|
+
| `CudaCosineLinear` | Sparse | 47.67 / 8,546 | 31.48 / 9,568 | 50.71 / 9,534 | 33.93 / 10,556 |
|
|
191
|
+
|
|
192
|
+
GNPS-10k yielded 9,977 eligible spectra in file order. The 8,388,608-pair run used the first 4,096 references and the next 2,048 queries. The 18,432,000-pair run used the first 9,000 references and the last 2,048 queries, including 1,071 spectra present on both sides. Each GPU report includes the dataset and wheel checksums, package versions, exact slices, probe code, timings and memory measurements.
|
|
193
|
+
|
|
194
|
+
## How do I get reference IDs, query IDs and scores as arrays?
|
|
195
|
+
|
|
196
|
+
Use `min_score` for an inclusive threshold on the GPU. Cosine scorers also accept `min_matches`. Each selected field is available as a SciPy `coo_array`. Its row and column indices refer to positions in your two input collections.
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
hits = sim.sparse_matrix(refs, queries, min_score=0.75)
|
|
200
|
+
coo = hits.to_coo("score")
|
|
201
|
+
ref_idx, query_idx, values = coo.row, coo.col, coo.data
|
|
202
|
+
matched_peaks = hits.to_coo("matches").data # same stored coordinates
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
For a custom rule, pass a Python predicate. When combined with a threshold, it receives only the surviving full scores, before field projection.
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
hits = sim.sparse_matrix(refs, queries, min_score=0.75, score_filter=lambda s: 3 <= s["matches"] <= 10)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Use `idx_row` and `idx_col` to score only a supplied set of coordinate pairs. Repeated coordinates count once. In a commutative self-comparison, either triangle selects the pair and both directions are returned. Thresholding alone still evaluates the pairs before selecting which results to store.
|
|
212
|
+
|
|
213
|
+
## Citing SimMS
|
|
214
|
+
|
|
215
|
+
```bibtex
|
|
216
|
+
@article{onoprishvili2025simms,
|
|
217
|
+
author = {Onoprishvili, Tornike and Yuan, Jui-Hung and Petrov, Kamen and Ingalalli, Vijay and Khederlarian, Lila and Leuchtenmuller, Niklas and Chandra, Sona and Duarte, Aurelien and Bender, Andreas and Gloaguen, Yoann},
|
|
218
|
+
title = {SimMS: A GPU-Accelerated Cosine Similarity implementation for Tandem Mass Spectrometry},
|
|
219
|
+
journal = {Bioinformatics},
|
|
220
|
+
year = {2025},
|
|
221
|
+
month = {02},
|
|
222
|
+
doi = {10.1093/bioinformatics/btaf081}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# SimMS
|
|
2
|
+
|
|
3
|
+
SimMS compares tandem mass spectra on an NVIDIA GPU using the scoring algorithms in matchms 1.0.0. A score matrix has one row per reference and one column per query. Peak-matching cosine methods also return the number of assigned peaks.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
The PyPI distribution is `simms-gpu`. Import it in Python as `simms`. Use Python 3.11 through 3.14, an NVIDIA driver compatible with your CUDA runtime and a CUDA-enabled build of PyTorch for that runtime. Choose the matching wheel with the [PyTorch installation selector](https://pytorch.org/get-started/locally/).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# CUDA 12, in an environment with a matching CUDA 12 PyTorch build
|
|
11
|
+
pip install "simms-gpu[cu12]"
|
|
12
|
+
|
|
13
|
+
# CUDA 13
|
|
14
|
+
pip install "simms-gpu[cu13]"
|
|
15
|
+
|
|
16
|
+
# Include chemap for generating molecular fingerprints
|
|
17
|
+
pip install "simms-gpu[cu13,fingerprints]"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For CUDA 12 fingerprints, use `simms-gpu[cu12,fingerprints]`. The CUDA extras supply the numba-cuda compiler and runtime dependencies. Check PyTorch with `python -c "import torch; print(torch.version.cuda, torch.cuda.is_available())"` before running on the GPU.
|
|
21
|
+
|
|
22
|
+
## Quickstart
|
|
23
|
+
|
|
24
|
+
This example loads the GNPS pesticide library and ranks references for the first query. Both collections use the same m/z grid. One-shot MGF iterators can also be passed directly to `calculate_scores`, `matrix`, `sparse_matrix`, or `PeakArrays.from_spectra`. With `CosineGreedy` defaults, each spectrum needs a positive finite precursor m/z for precursor removal.
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import numpy as np
|
|
28
|
+
from matchms import Scores, SpectraCollection, calculate_scores
|
|
29
|
+
from matchms.importing import load_from_mgf
|
|
30
|
+
from simms.similarity import CudaCosineGreedy
|
|
31
|
+
from simms.utils import download
|
|
32
|
+
|
|
33
|
+
spectra = list(load_from_mgf(download("pesticides.mgf")))
|
|
34
|
+
refs = SpectraCollection(spectra[:40])
|
|
35
|
+
queries = SpectraCollection(spectra[40:])
|
|
36
|
+
sim = CudaCosineGreedy()
|
|
37
|
+
scores = calculate_scores(spectra_1=refs, spectra_2=queries, similarity_function=sim)
|
|
38
|
+
assert isinstance(scores, Scores)
|
|
39
|
+
|
|
40
|
+
query_scores = scores.to_array("score")[:, 0]
|
|
41
|
+
matches = scores.to_array("matches")[:, 0]
|
|
42
|
+
for i in np.argsort(-query_scores, kind="stable")[:5]:
|
|
43
|
+
print(i, query_scores[i], matches[i])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For an all-against-all comparison use `sim.matrix(refs)`. To reuse padded peak arrays and keep the output on the GPU, use the same scorer directly.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from simms import PeakArrays
|
|
50
|
+
|
|
51
|
+
left = PeakArrays.from_spectra(refs)
|
|
52
|
+
right = PeakArrays.from_spectra(queries)
|
|
53
|
+
planes = sim.matrix(left, right, array_type="torch")
|
|
54
|
+
best_ref_per_query = planes[0].argmax(dim=0)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The default cosine tensor has shape `(2, n_refs, n_queries)`, with score and matches in that order. Scalar methods return a two-dimensional tensor. `batch_size` limits each tile axis. A dense Torch result still needs enough device memory for the entire output.
|
|
58
|
+
|
|
59
|
+
## GPU similarities
|
|
60
|
+
|
|
61
|
+
| SimMS class | matchms 1.0.0 counterpart | What it compares |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `CudaCosineGreedy` | `CosineGreedy` | One-to-one fragment matches ranked by weighted intensity product |
|
|
64
|
+
| `CudaModifiedCosineGreedy` | `ModifiedCosineGreedy` | Direct and precursor-shifted candidates in a shared assignment |
|
|
65
|
+
| `CudaNeutralLossesCosine` | `NeutralLossesCosine` | Precursor-shifted fragment matches |
|
|
66
|
+
| `CudaEntropyGreedy` | `EntropyGreedy` | Entropy-weighted fragment, neutral-loss or hybrid matches |
|
|
67
|
+
| `CudaCosineLinear` | `CosineLinear` | Linear fragment matching after merging nearby peaks |
|
|
68
|
+
| `CudaModifiedCosineLinear` | `ModifiedCosineLinear` | Linear matching with a precursor shift and conflict resolution |
|
|
69
|
+
| `CudaBinnedEmbeddingSimilarity` | `BinnedEmbeddingSimilarity` | Cosine or Euclidean similarity of binned intensities |
|
|
70
|
+
| `CudaFingerprintSimilarity` | `FingerprintSimilarity` | Tanimoto or cosine over molecular fingerprints |
|
|
71
|
+
|
|
72
|
+
`CudaModifiedCosine` is an alias for `CudaModifiedCosineGreedy`. Fingerprint matrices are indexed by valid unique compounds, in matchms `Fingerprints.inchikeys` order on each axis. Use a chemap-compatible generator with valid InChIKey and SMILES or InChI metadata, or pass prepared containers as `fingerprints_1` and `fingerprints_2`. A precursor mask for fingerprint scoring must use those same compound axes. A spectrum-level mask is directly reusable when each spectrum represents a different valid compound on its axis. RDKit generators with JSON support can be exported through `to_dict()` and reconstructed from the saved parameters. Embedding, entropy and fingerprint scorers return a single score field.
|
|
73
|
+
|
|
74
|
+
Binned embeddings and precomputed fingerprints also run on CPU. The six spectral CUDA scorers require a CUDA device or the Numba simulator. For simulator tests, set `NUMBA_ENABLE_CUDASIM=1` before starting Python.
|
|
75
|
+
|
|
76
|
+
## Transitive alignment
|
|
77
|
+
|
|
78
|
+
`CudaTransitiveAlignment` builds an undirected network from one collection of spectra. Its defaults retain direct modified-cosine edges with a score of at least 0.7 and at least six matches. Each reachable non-edge uses the fewest-hop path with the highest sum of direct scores. Set `max_hops` to limit path length. [Wang et al., JASMS 2024](https://doi.org/10.1021/jasms.4c00208)
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from simms.similarity import CudaTransitiveAlignment
|
|
82
|
+
|
|
83
|
+
aligner = CudaTransitiveAlignment()
|
|
84
|
+
result = aligner.align(spectra, return_peak_pairs=True)
|
|
85
|
+
bridges = result.to_scores(sparse=True, transitive_only=True)
|
|
86
|
+
for edge in result.transitive_edges:
|
|
87
|
+
key = (edge.row, edge.col)
|
|
88
|
+
print(edge.score, result.paths[key], result.peak_pairs[key])
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The aligner is available by explicit import. `simms.similarity.__all__` lists the pairwise scorers. Use `aligner.sparse_matrix(spectra, min_score=0.8)` to filter the final edges after path selection.
|
|
92
|
+
|
|
93
|
+
Pass `base_scores=...` to `align`, `matrix`, or `sparse_matrix` to reuse dense or sparse direct scores with both `score` and `matches` fields. Use the same spectrum order and preprocessing as the original calculation. Paths use input spectrum indices. Peak pairs use zero-based indices after precursor and noise filtering. The score matrices store edges symmetrically with a zero diagonal. Use `result.to_dict()` to serialize the paths and evidence to JSON.
|
|
94
|
+
|
|
95
|
+
## RTX 4060 Laptop benchmark
|
|
96
|
+
|
|
97
|
+
Each row compares 1,024 references with 1,024 disjoint queries on an Intel Core i9-14900HX and an 8 GB RTX 4060 Laptop GPU. The inputs are the first eligible spectra in file order from GNPS-random-10k, with nonempty peaks and positive finite precursor m/z. The fingerprint rows use two disjoint sets of 1,024 unique compounds from the same file, encoded once with RDKit Morgan radius 2, 2,048 bits and matchms/chemap.
|
|
98
|
+
|
|
99
|
+
Times are seconds for one warmed dense `matrix` call, using matchms 1.0.0 defaults unless indicated. They include spectrum preparation, device transfers and host output. MGF parsing, fingerprint generation and JIT warmup are excluded. GPU tile size was 256. Flash times include building its CPU index, with the default worker count. Speedup uses the named CPU counterpart. VRAM is peak process memory sampled with NVML every 5 ms, including the CUDA context and allocator caches retained across cases. The JSON also records PyTorch's peak allocated bytes in MiB.
|
|
100
|
+
|
|
101
|
+
| Method and settings | matchms CPU (s) | SimMS GPU (s) | Speedup | Flash CPU (s) | Max abs. score difference | Count mismatches | VRAM (MiB) |
|
|
102
|
+
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
|
103
|
+
| CosineGreedy | 36.148 | 0.285 | 126.73× | 0.059 | 0 | 0 | 1600 |
|
|
104
|
+
| CosineGreedy 0.5 Da | 39.004 | 0.308 | 126.47× | 0.069 | 0 | 0 | 1600 |
|
|
105
|
+
| CosineGreedy 0.5 Da mz_power=1.0 | 39.699 | 0.315 | 125.95× | n/a | 0 | 0 | 1600 |
|
|
106
|
+
| ModifiedCosineGreedy | 39.709 | 0.286 | 138.75× | n/a | 0 | 0 | 1600 |
|
|
107
|
+
| NeutralLossesCosine | 35.542 | 0.278 | 127.92× | n/a | 0 | 0 | 1600 |
|
|
108
|
+
| EntropyGreedy fragment | 80.557 | 0.103 | 784.89× | 0.068 | 4.44e-16 | n/a | 1600 |
|
|
109
|
+
| EntropyGreedy hybrid | 100.485 | 0.153 | 655.12× | 0.074 | 4.44e-16 | n/a | 1600 |
|
|
110
|
+
| CosineLinear | 3.389 | 0.074 | 46.01× | n/a | 0 | 0 | 1600 |
|
|
111
|
+
| ModifiedCosineLinear | 4.136 | 0.101 | 40.86× | n/a | 0 | 0 | 1600 |
|
|
112
|
+
| BinnedEmbeddingSimilarity float64 | 0.070 | 0.056 | 1.25× | n/a | 2.33e-15 | n/a | 1620 |
|
|
113
|
+
| BinnedEmbeddingSimilarity float32 | 0.071 | 0.037 | 1.89× | n/a | 4.61e-07 | n/a | 1620 |
|
|
114
|
+
| FingerprintSimilarity tanimoto | 0.042 | 0.048 | 0.88× | n/a | 2.96e-08 | n/a | 1640 |
|
|
115
|
+
| FingerprintSimilarity cosine | 0.033 | 0.064 | 0.51× | n/a | 7.38e-08 | n/a | 1640 |
|
|
116
|
+
|
|
117
|
+
Every cosine peak-matching row agreed on all 1,048,576 scores and counts. Entropy, embedding and fingerprint methods return scores only. Fingerprint CPU computations use float32 inputs, which accounts for small differences against the FP64 GPU calculation.
|
|
118
|
+
|
|
119
|
+
**Choosing an implementation.** For default fragment cosine or fragment/hybrid entropy on this GNPS slice, the CPU Flash implementations finished first. CosineFlash also led at 0.5 Da. Its interface supports intensity weighting but has no `mz_power` parameter. Use GPU greedy cosine when you need that weighting, or when later operations can consume the device tensor. For repeated searches against a fixed library, matchms can reuse a Flash index. Flash has its own matching conventions, so the parity columns above compare SimMS with the named CPU oracle. For precomputed Morgan fingerprints at this size, the CPU won both comparisons.
|
|
120
|
+
|
|
121
|
+
**Device-resident output.** With prepacked `PeakArrays`, `CudaCosineGreedy` produced a `(2, 4096, 2048)` FP64 CUDA tensor in 2.044 s, or **4.10 million pairs/s**. The timer excludes initial array construction and includes scoring through CUDA synchronization. Sampled process VRAM peaked at 1,768 MiB, with 137.36 MiB of live PyTorch allocations at their peak.
|
|
122
|
+
|
|
123
|
+
To reproduce on Linux with a CUDA GPU, run these commands from the checkout. Use `--mgf tests/data/pesticides.mgf --size 32 --demo-rows 48 --demo-cols 24` for a smaller run against the bundled file, with `--output /tmp/pesticides.json` to keep its results separate.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
python -m pip install -e ".[cu13,fingerprints]" nvidia-ml-py
|
|
127
|
+
NUMBA_CUDA_LOW_OCCUPANCY_WARNINGS=0 python benchmarks/benchmark_matchms.py
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The full-precision results include the dataset SHA-256, software versions, timings and peak memory for each row. [Benchmark script](benchmarks/benchmark_matchms.py) · [Measured results](benchmarks/rtx4060.json)
|
|
131
|
+
|
|
132
|
+
## Multi-GPU Validation & Scaling
|
|
133
|
+
|
|
134
|
+
Both GPUs ran the same `simms-gpu 1.0.0` wheel in fresh Python 3.12 environments. The wheel smoke test exercised all nine GPU scorers. All 13 dense matchms comparisons met the [RTX 4060 benchmark](#rtx-4060-laptop-benchmark) parity tolerances, and the 1,024-spectrum transitive alignment matched the CPU reference exactly on both GPUs.
|
|
135
|
+
|
|
136
|
+
| GPU | Architecture | Wheel extras | PyTorch / CUDA runtime | Pytest | Transitive alignment, warm GPU / CPU (s) |
|
|
137
|
+
|---|---|---|---:|---:|---:|
|
|
138
|
+
| [NVIDIA GeForce RTX 4090](benchmarks/vast_rtx_4090.json) | Ada Lovelace | `cu12,fingerprints` | 2.10.0 / 12.8 | 341/341 | 0.102 / 17.47 |
|
|
139
|
+
| [NVIDIA A100-SXM4-80GB](benchmarks/vast_a100_sxm4.json) | Ampere | `cu13,fingerprints` | 2.15.0 / 13.2 | 341/341 | 0.097 / 32.97 |
|
|
140
|
+
|
|
141
|
+
Each cell gives **million pairs/s / peak process VRAM (MiB)** for one warmed call with prepacked FP64 `PeakArrays` and tile size 256. Torch returns a dense device tensor. Sparse applies `min_score=0.7` on the GPU and returns the retained coordinates and scores on the host. Throughput counts every evaluated pair. NVML samples process memory every 5 ms, including the CUDA context and allocator caches.
|
|
142
|
+
|
|
143
|
+
| Scorer | Output | RTX 4090, 4,096 × 2,048 | A100, 4,096 × 2,048 | RTX 4090, 9,000 × 2,048 | A100, 9,000 × 2,048 |
|
|
144
|
+
|---|---|---:|---:|---:|---:|
|
|
145
|
+
| `CudaCosineGreedy` | Torch | 11.24 / 8,480 | 11.22 / 9,502 | 11.04 / 9,110 | 11.27 / 10,132 |
|
|
146
|
+
| `CudaCosineGreedy` | Sparse | 11.08 / 8,544 | 11.11 / 9,566 | 10.40 / 9,252 | 11.02 / 10,274 |
|
|
147
|
+
| `CudaModifiedCosineGreedy` | Torch | 10.80 / 8,544 | 10.79 / 9,566 | 10.05 / 9,534 | 10.68 / 10,556 |
|
|
148
|
+
| `CudaModifiedCosineGreedy` | Sparse | 10.67 / 8,546 | 10.60 / 9,568 | 9.87 / 9,534 | 10.61 / 10,556 |
|
|
149
|
+
| `CudaEntropyGreedy` | Torch | 34.11 / 8,546 | 24.51 / 9,568 | 37.39 / 9,534 | 25.59 / 10,556 |
|
|
150
|
+
| `CudaEntropyGreedy` | Sparse | 31.83 / 8,546 | 22.22 / 9,568 | 34.67 / 9,534 | 24.32 / 10,556 |
|
|
151
|
+
| `CudaCosineLinear` | Torch | 54.45 / 8,546 | 36.42 / 9,568 | 57.96 / 9,534 | 38.04 / 10,556 |
|
|
152
|
+
| `CudaCosineLinear` | Sparse | 47.67 / 8,546 | 31.48 / 9,568 | 50.71 / 9,534 | 33.93 / 10,556 |
|
|
153
|
+
|
|
154
|
+
GNPS-10k yielded 9,977 eligible spectra in file order. The 8,388,608-pair run used the first 4,096 references and the next 2,048 queries. The 18,432,000-pair run used the first 9,000 references and the last 2,048 queries, including 1,071 spectra present on both sides. Each GPU report includes the dataset and wheel checksums, package versions, exact slices, probe code, timings and memory measurements.
|
|
155
|
+
|
|
156
|
+
## How do I get reference IDs, query IDs and scores as arrays?
|
|
157
|
+
|
|
158
|
+
Use `min_score` for an inclusive threshold on the GPU. Cosine scorers also accept `min_matches`. Each selected field is available as a SciPy `coo_array`. Its row and column indices refer to positions in your two input collections.
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
hits = sim.sparse_matrix(refs, queries, min_score=0.75)
|
|
162
|
+
coo = hits.to_coo("score")
|
|
163
|
+
ref_idx, query_idx, values = coo.row, coo.col, coo.data
|
|
164
|
+
matched_peaks = hits.to_coo("matches").data # same stored coordinates
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
For a custom rule, pass a Python predicate. When combined with a threshold, it receives only the surviving full scores, before field projection.
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
hits = sim.sparse_matrix(refs, queries, min_score=0.75, score_filter=lambda s: 3 <= s["matches"] <= 10)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Use `idx_row` and `idx_col` to score only a supplied set of coordinate pairs. Repeated coordinates count once. In a commutative self-comparison, either triangle selects the pair and both directions are returned. Thresholding alone still evaluates the pairs before selecting which results to store.
|
|
174
|
+
|
|
175
|
+
## Citing SimMS
|
|
176
|
+
|
|
177
|
+
```bibtex
|
|
178
|
+
@article{onoprishvili2025simms,
|
|
179
|
+
author = {Onoprishvili, Tornike and Yuan, Jui-Hung and Petrov, Kamen and Ingalalli, Vijay and Khederlarian, Lila and Leuchtenmuller, Niklas and Chandra, Sona and Duarte, Aurelien and Bender, Andreas and Gloaguen, Yoann},
|
|
180
|
+
title = {SimMS: A GPU-Accelerated Cosine Similarity implementation for Tandem Mass Spectrometry},
|
|
181
|
+
journal = {Bioinformatics},
|
|
182
|
+
year = {2025},
|
|
183
|
+
month = {02},
|
|
184
|
+
doi = {10.1093/bioinformatics/btaf081}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "simms-gpu"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "Faster Similarity for Mass Spec on GPU"
|
|
5
|
+
authors = [
|
|
6
|
+
{name="Tornike Onoprishvili", email="tornikeonoprishvili@gmail.com"}
|
|
7
|
+
]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
requires-python = ">=3.11,<3.15"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"matchms>=1.0.0,<2.0.0",
|
|
13
|
+
"torch>=2.4.0",
|
|
14
|
+
"numba>=0.61",
|
|
15
|
+
"numba-cuda>=0.30",
|
|
16
|
+
"numpy>=2.0,<2.5",
|
|
17
|
+
"scipy>=1.11",
|
|
18
|
+
"tqdm>=4.66.4",
|
|
19
|
+
"joblib>=1.4.0",
|
|
20
|
+
"requests>=2.31.0",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Intended Audience :: Education",
|
|
25
|
+
"Intended Audience :: Science/Research",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"Natural Language :: English",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
]
|
|
30
|
+
keywords = [
|
|
31
|
+
"similarity measures",
|
|
32
|
+
"mass spectrometry",
|
|
33
|
+
"fuzzy matching",
|
|
34
|
+
"fuzzy search",
|
|
35
|
+
"CUDA",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
cu12 = ["numba-cuda[cu12]>=0.30", "cuda-core<1.3"]
|
|
40
|
+
cu13 = ["numba-cuda[cu13]>=0.30", "torch>=2.11"]
|
|
41
|
+
fingerprints = ["chemap>=0.3.9"]
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
homepage = "https://github.com/PangeAI/simms"
|
|
45
|
+
repository = "https://github.com/PangeAI/simms"
|
|
46
|
+
"Bug Tracker" = "https://github.com/PangeAI/simms/issues"
|
|
47
|
+
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["poetry-core>=2.0.0"]
|
|
50
|
+
build-backend = "poetry.core.masonry.api"
|
|
51
|
+
|
|
52
|
+
[tool.poetry]
|
|
53
|
+
packages = [{include = "simms"}]
|
|
54
|
+
|
|
55
|
+
[tool.poetry.group.docs]
|
|
56
|
+
optional = true
|
|
57
|
+
|
|
58
|
+
[tool.poetry.group.dev.dependencies]
|
|
59
|
+
pytest = "^7.4.0"
|
|
60
|
+
decorator = "^5.1.1"
|
|
61
|
+
isort = "^5.12.0"
|
|
62
|
+
pylint = "^2.17.5"
|
|
63
|
+
tbb = "^2021.12.0"
|
|
64
|
+
pytest-cov = "^4.1.0"
|
|
65
|
+
pytest-benchmark = {extras=["histogram"], version="^4.0.0"}
|
|
66
|
+
yapf = "^0.40.1"
|
|
67
|
+
testfixtures = "^7.1.0"
|
|
68
|
+
twine = "^4.0.2"
|
|
69
|
+
black = "^23.7.0"
|
|
70
|
+
|
|
71
|
+
[tool.poetry.group.docs.dependencies]
|
|
72
|
+
sphinxcontrib-apidoc = "^0.3.0"
|
|
73
|
+
sphinx-rtd-theme = "^1.2.2"
|
|
74
|
+
sphinx = "<7"
|
|
75
|
+
|
|
76
|
+
[tool.poetry_bumpversion.file."simms/__version__.py"]
|
|
77
|
+
|
|
78
|
+
[tool.isort]
|
|
79
|
+
sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
|
|
80
|
+
no_lines_before = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
|
|
81
|
+
lines_after_imports = 2
|
|
82
|
+
known_first_party = "simms"
|
|
83
|
+
profile = "black"
|
|
84
|
+
|
|
85
|
+
[tool.nbqa.mypy]
|
|
86
|
+
addopts = "--ignore-missing-imports"
|
|
87
|
+
|
|
88
|
+
[tool.nbqa.isort]
|
|
89
|
+
addopts = "--profile=black"
|
|
90
|
+
|
|
91
|
+
[tool.pytest.ini_options]
|
|
92
|
+
pythonpath = [
|
|
93
|
+
".",
|
|
94
|
+
]
|
|
95
|
+
addopts = "--doctest-modules"
|
|
96
|
+
testpaths = [
|
|
97
|
+
"./simms",
|
|
98
|
+
"./tests",
|
|
99
|
+
]
|
|
100
|
+
markers = [
|
|
101
|
+
"github_ci: marks tests as lightweight-enough to run on a CPU as a github CI",
|
|
102
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|