|
1 | 1 | # SMSD benchmarks |
2 | 2 |
|
3 | | -Run these tools from the repository root. Use the same molecules, chemistry |
4 | | -options and search budgets when comparing results, and check returned mappings. |
5 | | -The [8.0.0 validation record](../docs/VALIDATION_8.0.0.md) covers the release |
6 | | -checks; the measurement protocol below governs every reported result. |
| 3 | +This guide shows how to run the benchmarks and how to report their results. |
| 4 | +Run every command from the repository root, after building the current source. |
| 5 | +The [data guide](data/README.md) lists the input files, their sources and |
| 6 | +licences. |
7 | 7 |
|
8 | 8 | ## Prepared-query APIs |
9 | 9 |
|
10 | | -Build the source before running these workloads. The three runners read |
11 | | -`search_api_cases.tsv` and |
12 | | -write JSON Lines containing every measurement, parsed graph, atom and selected |
13 | | -bond mapping, fragments, stopping status and proof flags. |
| 10 | +The C++, Java and Python runners read `search_api_cases.tsv`, whose rows set |
| 11 | +the search, chemistry, budget, limits and batch size of each case. They write |
| 12 | +JSON Lines holding every measurement, mapping, stopping status and proof flag. |
14 | 13 |
|
15 | 14 | | Phase | Work inside the timer | |
16 | 15 | | --- | --- | |
@@ -19,13 +18,7 @@ bond mapping, fragments, stopping status and proof flags. |
19 | 18 | | `end_to_end` | Parse both inputs, prepare the query and search | |
20 | 19 | | `batch` | Search a collection of pre-parsed targets sequentially | |
21 | 20 |
|
22 | | -The corpus includes MCIS and MCES, connected and disconnected results, |
23 | | -weighted MCIS, molecule and SMARTS substructure, capped enumeration and batch |
24 | | -calls. Chemistry, budgets, limits and batch sizes are explicit in each row. |
25 | | -The `any` profile compares elements and ignores bond order; other profiles |
26 | | -exercise strict chemistry, rings, stereo and tautomer matching. |
27 | | - |
28 | | -From the repository root, run the Python and native workloads: |
| 21 | +Python and C++: |
29 | 22 |
|
30 | 23 | ```bash |
31 | 24 | mkdir -p build/search-benchmarks |
@@ -37,7 +30,7 @@ build/search-benchmarks/native --cases benchmarks/search_api_cases.tsv \ |
37 | 30 | --output build/search-benchmarks/cpp.jsonl --warmup 2 --repeats 5 |
38 | 31 | ``` |
39 | 32 |
|
40 | | -For Java, compile the runner against the current source-built dependency JAR: |
| 33 | +Java, against the source-built dependency JAR: |
41 | 34 |
|
42 | 35 | ```bash |
43 | 36 | mvn -f java/pom.xml package -DskipTests |
@@ -48,34 +41,23 @@ java -cp "build/search-benchmarks:java/cli/target/smsd-cli-8.0.0-jar-with-depend |
48 | 41 | --output build/search-benchmarks/java.jsonl --warmup 2 --repeats 5 |
49 | 42 | ``` |
50 | 43 |
|
51 | | -Use a semicolon instead of a colon in the Java classpath on Windows. With |
52 | | -Java 8, replace `--release 8` with `-source 8 -target 8`. All runners accept |
| 44 | +On Windows, separate classpath entries with `;`. With a Java 8 compiler, |
| 45 | +replace `--release 8` with `-source 8 -target 8`. Every runner accepts |
53 | 46 | `--case ID` and `--phase PHASE` to select a workload. |
54 | 47 |
|
55 | | -Validate the recorded results before analysing timings: |
| 48 | +Validate the results before analysing any timing; the validator checks every |
| 49 | +returned mapping and compares completed results across the languages: |
56 | 50 |
|
57 | 51 | ```bash |
58 | 52 | python benchmarks/search_api_validation.py --cases benchmarks/search_api_cases.tsv \ |
59 | 53 | --results build/search-benchmarks/cpp.jsonl build/search-benchmarks/java.jsonl \ |
60 | 54 | build/search-benchmarks/python.jsonl --output build/search-benchmarks/validation.json |
61 | 55 | ``` |
62 | 56 |
|
63 | | -The independent validator checks returned mappings, selected components and |
64 | | -completed cross-language results. Small eligible graphs also use exhaustive |
65 | | -objective checks. It reports predicates and graph sizes outside its independent |
66 | | -oracle scope explicitly; language regression tests cover those contracts. |
67 | | -Raw embeddings are compared after accounting for parser atom order. |
68 | | - |
69 | | -Keep preparation and warm search results separate. Use several fresh processes |
70 | | -in a balanced order, record compiler, runtime, source and power conditions, and |
71 | | -retain every observation. Timing ratios require the same objective and matching |
72 | | -rules with completed proofs. A timeout with a valid incumbent is a separate |
73 | | -quality outcome. Run coverage and builds outside the timing window. |
74 | | - |
75 | | -## Python |
| 57 | +## Python and RDKit |
76 | 58 |
|
77 | 59 | Install SMSD and RDKit in the same environment. These short runs check the |
78 | | -benchmark tools; they do not measure the full corpus: |
| 60 | +scripts rather than measure the full inputs: |
79 | 61 |
|
80 | 62 | ```bash |
81 | 63 | python benchmarks/benchmark_python.py \ |
@@ -90,37 +72,23 @@ python benchmarks/benchmark_bindings.py \ |
90 | 72 | --output build/local-benchmarks/bindings-smoke.json |
91 | 73 | ``` |
92 | 74 |
|
93 | | -Remove `--limit 1` for the full external corpus. Use `--resume` with the same |
94 | | -arguments and environment to continue an interrupted run. Results record the |
95 | | -imported package paths and versions. |
| 75 | +Remove `--limit 1` to run every external pair, and add `--resume` with the |
| 76 | +same arguments and environment to continue an interrupted run. |
96 | 77 |
|
97 | | -| Tool | Measures | |
| 78 | +| Script | Measures | |
98 | 79 | |---|---| |
99 | | -| `benchmark_python.py` | The 20 curated MCS pairs in `data/mcs_pairs.tsv` and 20 substructure cases | |
100 | | -| `run_external_benchmarks.py` | Random and neighbouring pairs, tautomer pairs, stress cases and SMARTS | |
| 80 | +| `benchmark_python.py` | The curated MCS pairs in `data/mcs_pairs.tsv` and substructure cases | |
| 81 | +| `run_external_benchmarks.py` | Random and nearest-neighbour pairs, tautomer pairs, stress cases and SMARTS | |
101 | 82 | | `benchmark_bindings.py` | Parsing, RDKit conversion, scalar calls and batch overhead | |
102 | 83 |
|
103 | | -The external MCS runner checks mappings and records completion and stopping |
104 | | -status. Stopped searches are excluded from speed ratios. |
105 | | - |
106 | 84 | | Policy | Matching rules | |
107 | 85 | |---|---| |
108 | 86 | | `any` | Matching elements, with any bond order | |
109 | | -| `strict` | Exact bonds, charge, ring membership and aromatic atoms; RDKit uses a Python comparator | |
110 | | -| `fmcs` | SMSD strict bond order with flexible aromaticity; RDKit uses `CompareOrder` | |
111 | | - |
112 | | -Different MCS edge and aromaticity rules can produce different results. The |
113 | | -mapping checks of the external MCS runner, above, are in `mcs_protocol.py`, and |
114 | | -the comparison limits under [Prepared-query APIs](#prepared-query-apis) apply. |
115 | | -The [data guide](data/README.md) records corpus sources and counts. The derived |
116 | | -Dalke-style pairs are separate from the original Dalke benchmark. |
| 87 | +| `strict` | Exact bonds, charge, ring membership and aromatic atoms | |
| 88 | +| `fmcs` | Strict bond order with flexible aromaticity; RDKit uses `CompareOrder` | |
117 | 89 |
|
118 | 90 | ## Java and C++ |
119 | 91 |
|
120 | | -Build the Java CLI with Maven and a JDK. Java 25 LTS is preferred for the |
121 | | -build, and the JAR runs on Java 8 or later. C++ benchmarks require a C++17 |
122 | | -compiler. |
123 | | - |
124 | 92 | ```bash |
125 | 93 | mvn -f java/pom.xml package -DskipTests |
126 | 94 | python benchmarks/benchmark_leaderboard.py --mode integration |
@@ -131,14 +99,33 @@ c++ -std=c++17 -O3 -Icpp/include benchmarks/benchmark_primitives.cpp \ |
131 | 99 | build/local-benchmarks/primitives assignment |
132 | 100 | ``` |
133 | 101 |
|
134 | | -The integration driver measures the Java CLI, including its start-up time, |
135 | | -against RDKit on the curated MCS pairs, and Java substructure matching against |
136 | | -RDKit and CDK on `substructure_pairs.tsv`. The C++ shell benchmark compiles |
137 | | -the SMSD headers and measures the supplied stress pairs. The primitive |
138 | | -benchmark times native assignment and general matching (`assignment`, with an |
139 | | -optional repeat multiplier), NLF3 construction and a complete-subgraph MCS |
140 | | -(`primitives`) and cold-target matcher set-up (`setup`); each selector prints |
141 | | -checksums that must agree between builds. These timings have different |
142 | | -set-up costs from the Python benchmarks. |
143 | | - |
144 | | -For opt-in Java corpus tests, see the [build guide](../docs/HOWTO-INSTALL.md). |
| 102 | +The integration driver times the Java CLI, including its start-up, against |
| 103 | +RDKit on the curated MCS pairs, and Java substructure search against RDKit and |
| 104 | +CDK on `substructure_pairs.tsv`; its results are not engine rankings. |
| 105 | +`benchmark_cpp.sh` builds and times C++ MCS search on the stress pairs. |
| 106 | +`benchmark_primitives` takes the selector `assignment`, `primitives` or |
| 107 | +`setup` and prints checksums that must agree between builds. |
| 108 | + |
| 109 | +The Java benchmark tests are off by default. To run them: |
| 110 | + |
| 111 | +```bash |
| 112 | +mvn -f java/pom.xml -pl core test -Dslow.tests.exclude=nothing \ |
| 113 | + '-Dtest=BenchmarkSuiteTest*,ExternalBenchmarkTest*,JavaCdkVsSmsdBenchmarkTest' \ |
| 114 | + -Dbenchmark=true -Dsmsd.benchmark=true |
| 115 | +``` |
| 116 | + |
| 117 | +The system properties `smsd.benchmark.timeoutMillis` (default `1000`), |
| 118 | +`smsd.benchmark.rounds` (default `1`) and `smsd.benchmark.warmup` (default `0`) |
| 119 | +set the run, and results go to `build/local-benchmarks/java` unless |
| 120 | +`smsd.benchmark.outputDir` names another directory. |
| 121 | + |
| 122 | +## Reporting results |
| 123 | + |
| 124 | +- Validate every returned mapping before analysing timings. |
| 125 | +- Report each phase separately, and keep preparation apart from warm searches. |
| 126 | +- Use several fresh processes in a balanced order and retain every observation. |
| 127 | +- Record the compiler, runtime, source revision and power conditions. |
| 128 | +- Compare timings only for the same objective, chemistry and matching rules, |
| 129 | + and only between completed searches; report stopped and timed-out searches, |
| 130 | + even with a valid mapping, as separate outcomes. |
| 131 | +- Keep builds and coverage runs outside the timing window. |