Skip to content

Commit

Permalink
Merge pull request #402 from unum-cloud/main-dev
Browse files Browse the repository at this point in the history
* Improve: Swift test for issue #399 (#400)

* Fix: Integer overflow in aligned-alloc

Fixes ClickHouse/ClickHouse#61780

Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>

* Make: Disable Windows NPM builds

Relates to the #377 and the comment:
#377 (comment)

This temporarily disables the failing CI pipeline to generate
and update docs.

* Fix: Going beyond level 0 in clustering

* Improve: Error handling in `index_dense_gt`

This commit drops `std::vector` dependency,
making compilation time shorter and error
handling universal across abstraction layers.

* Improve: Remove `std::function` calls

* Improve: Remove `std::thread` from `index_dense_gt`

* Improve: `std::vector` -> `buffer_gt` in plugins

* Add: `usearch_change_threads_search`

* Fix: `index_dense_t::make(path)`

* Fix: Exhastive Search

In the past, if we got "too lucky" traversing the graph,
we could exit early before accumulating K top matches,
even if the index had more than K entries. This patch
changes that behavior, making output more predicatable.

* Fix: Replacement leaves isolated nodes

This patch addresses the issue #399, originally
observed in the Swift layer. Reimplementing it in
C++ helped locate the issue and lead to refactoring
the `update` procedure in the lowest-layer `index_gt`.

Now, `add` and `update` share less code. The `add`
is one branch shorter (not that it would be noticeable),
and `update` brings additional logic to avoid spilling
`updated_slot` into top-results and consequently
introducing self-loops.

Closes #399

* Fix: Misc warnings & compilation issues

* Fix: Misc warnings & compilation issues

* Fix: Detect `ring_gt` being full

Relates to #355

* Fix: Re-init `available_threads_` after load

Both `view` and `load` would `reset` the thread contexts.
After that, the very first `search` and `add` would fail, as
no thread-local contexts are initialized. It would require
a `reserve` call with a non-zero second arcgument to
define the number of concurrent threads, for which the
queues & buffers need to be allocated.

That design is counter-intuitive, so this patch re-inits the
same number of threads as before the `load` & `view` or
one, if none existed.

* Fix: `uint32_t` to `uint40_t` cast (#404)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Docs: Mention `b1` in `README.md`

Co-authored-by: Adolfo Garcia <1250775+adolfogc@users.noreply.github.com>

* Docs: Cover new users

* Improve: Updates stability & catch bug

* Fix: Dereferencing `member_iterator_t`

* Add: Java `get` API (#407)

* Fix: Compilation with `uint40_t` keys

* Add: `AutoClosable` using `c_destroy` for Java (#408)

* Fix: Rare deadlock on tiny collections

* Improve: `enable_key_lookups=false` memory usage

As noted by Robert Schulze, we can avoid populating `slot_lookup_`
during insertions, if `enable_key_lookups` is not set. This would lead
to lower memory consumption for large indexes of tiny vectors,
particularly common in GIS.

Co-authored-by: Robert Schulze <robert@clickhouse.com>

* Fix: Preset `enable_key_lookups=true` in C

* Fix: `std::is_pod` deprecated in C++20

* Fix: Unused type aliases

* Improve: Avoid `#pragma region` pre GCC 13 (#386)

* Do not use #pragma region if not supported by the compiler
* `pragma region` supported by GCC 13+

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85487

---------

Co-authored-by: Mikhail Bautin <mbautin@users.noreply.github.com>
Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Fix: Capacity checks in C# tests

* Docs: Add doc-strings in C#

* Make: Verbose C# logging in debug builds

* Docs: Describe serialization in GoLang

* Make: Drop Java & JS API references

Compiling and introspecting docstrings in Sphinx
is extremely flaky. It's safer to simply describe the
usage patterns in the `README.md`.

* Add: Load from path in Java (#410)

* Improve: Avoid sorting on small "refines"

* Docs: Cover JIT-compiled Python examples

* Fix: `index.copy()` trying to `memcpy(*, NULL, *)`

* Docs: UB in C++ Example (#415)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Improve: Catch UB with tests

* Docs: Rearrange

* Fix: Reserving contexts post-reload

* Improve: Detect more failures in tests

* Improve: Log failing lines

* Fix: Clamp before down-casting to `i8_t` (#422)

Previously we were down-casting floats to the target type (e.g. int8_t), and then
clamping to [-100, 100] range. This means that e.g. 129 would be cast to -127 and
then converted to -100, in stead of becoming 100

The fix does clamping first, and then casts the resulting number
(which is guaranteed to be in range [-100, 100], due to clamping)
from source type to target int8_t. Given the clamping, this will never overflow.

---------

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Fix: Concurrency bug in high-K search

When calling `index_dense_gt`, the thread lock was not propagating
with the `search_result_t`. That is a an error-prone API. When too many
threads are running in parallel (ideally, more than physical CPU cores)
another thread may start reusing the `context_t` before the original
caller finishes exporting entries with `dump_to`.

This solution is backwards compatible and passes the tests.

* Make: Manually bump version to 2.13.0

We can't yet rely on the SemVer tool
semantic-release/release-notes-generator#633 (comment)

* Improve: Attempt to implement batch-metrics

* Add: Batch-capable metrics

* Add: `misaligned_ptr_gt` comparators

* Improve: Separate `error_t` constructors

This makes debugging easier, as it's simpler to trace
where the error message is being set.

* Improve: Support `enum` slots

Tracing implicit conversions of `std::uint32_t` and other
primitive types isn't always easy in concurrent apps. This
commit adds support for `enum` types to be used for
safer implementation of `index_gt` specializations.

* Improve: Ranges-V3 compatibility

* Add: Preliminary support for batch metrics

* Add: Batch-parallel refinements

* Add: `MANIFEST.in` for `py.typed` (#425)

Adding type annotation for Python native modules
solves the `Skipping analyzing "usearch.index" module` 
warning due to `missing library stubs or py.typed marker`.

Closes #424

* Fix: Clear cast buffer before bitwise ORs for `b1x8_t` (#428)

When converting floating point arrays to binary, we use bitwise OR
operations to set the relevant bits in the output buffer to 1. We do
nothing if the bit is zero, so we assume that the bit is zero to start
with. The `memset` statement makes sure this assumption holds.

* Fix: `esm` duplicate import bug in `jest` (#420)

Closes #418
Closes #426

* Fix: build.gradle deprecations

* Fix: ESM build support (#433)

Closes #426
Relates to #420

* Fix: `capacity()` assertion in Rust (#436)

Closes #432

* Fix: Computing `stats(i).max_edges`

* Add: Returning `computed_distances_in_refines`

In high-connectivity graphs, the number of distance
computations can be dominated by the number of "refine"
heuristic computations performed by the core structure.
The extended `add_result_t` now includes both:

- `computed_distances_in_refines`
- `computed_distances_in_reverse_refines`

This commit also extends the documentation.

* Add: Profiling attributes for `index_gt`

* Fix: Preserve thread limits after `fork()`

* Improve: Benchmarks self-recall support and `.bbin`

This patch adds support for partial datasets, without
ground truth neighborhood data. It also adds support
for `.bbin` binary, `.hbin` half-precision, and `.dbin`
double-precision input vector files/

* Fix: Printing progress between exit

* Docs: Fix spelling

* Fix: Wolfram bindings (#437)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Fix: Pre-reserve enough threads for C users

This indirectly fixes the crash in C# layer

* Revert: Parallel metrics

* Fix: Updating the `entry_slot_` node

* Improve: Enable single-threaded update tests

* Make: Bump version

* Fix: `flat_hash_multi_set_gt::reset` double-free

* Fix: Not enough memory in `fork()`

* Make: Bump to SimSIMD v5

* Fix: Missing SimSIMD v5 capability names

* Improve: Detecting copy & move issues

* Fix: Compilation w. explicit `template class`

* Improve: Bypass UBSan NULL dereferencing warning

* Improve: Minimize alignment issues

* Make: Disable `bf16` on MacOS

* Make: Link to GitHub repo

* Fix: Conditional `call_key` compilation in MSVC

* Fix: Unary minus on unsigned distances

* Make: Disable `bf16` in JS

* Fix: Compatibility with pre-v2.10

Closes #423

* Improve: Test wrong number of dimensions in Rust (#413)

Closes #412

---------

Co-authored-by: Julius Brummack <juliusbrummack@icloud.com>

* Fix: Handle wrong dimensionality in Rust

* Fix: Overwriting `SIMSIMD_DYNAMIC_DISPATCH`

* Make: Upgrade Java version

* Fix: Spelling mistakes

* Fix: `sprintf` deprecated

* Fix: `-Wpass-failed=transform-warning`

* Fix: Memory pinning on `Add` in C#

* Make: Specify Java distribution

* Fix: Pin memory in gets (C#)

* Make: Skip `PersistAndRestore` in CI on MacOS

* Make: Upgrade Docker action

This fixes a GitHub CI warning about the
deprecated NodeJS version.

* Fix: `view_from_buffer` is unsafe in Rust

Closes #453

Co-authored-by: Andrew Dirksen <2702854+bddap@users.noreply.github.com>"

* Fix: `view_from_buffer` is unsafe in Rust

Closes #453

Co-authored-by: Andrew Dirksen <2702854+bddap@users.noreply.github.com>

* Make: Upgrade SimSIMD

* Docs: Index header has no capacity

The lack of capacity data is intended.
Reserving memory is a non-persistent operation
by nature, and we shouldn't save that metadata
on the disk.

Closes #452

Co-authored-by: Christopher Yim <4638193+GoodKnight@users.noreply.github.com>

* Fix: Aggressive neighborhood checks on updates

* Fix: `update()` bug detect with non-POD keys

This bug was tough to spot. Apple Clang was the only one
that caught it. The `-O0` flags were explicitly added to expose
more symbols for debugging. More `uint40_t` tests were added.

* Fix: Align vector type w index in C# (#456)

Co-authored-by: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>

* Make: Versioning in pre-release CI

* Make: Switch from SemanticRelease to TinySemVer

---------

Co-authored-by: Jaysen Marais <jaysen.marais@gmail.com>
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
Co-authored-by: Narek Galstyan <narekg@berkeley.edu>
Co-authored-by: Adolfo Garcia <1250775+adolfogc@users.noreply.github.com>
Co-authored-by: Trevor McCulloch <mccullocht@gmail.com>
Co-authored-by: Robert Schulze <robert@clickhouse.com>
Co-authored-by: Mikhail Bautin <552936+mbautin@users.noreply.github.com>
Co-authored-by: Mikhail Bautin <mbautin@users.noreply.github.com>
Co-authored-by: SheldonFung <88470100+SheldonFung98@users.noreply.github.com>
Co-authored-by: James Braza <jamesbraza@gmail.com>
Co-authored-by: cinchen <eryue0220@gmail.com>
Co-authored-by: Mark Reed <markreed99@gmail.com>
Co-authored-by: John <jjmace01@gmail.com>
Co-authored-by: batracos <giulio.a@gmail.com>
Co-authored-by: Ziyang Hu <2103823+zh217@users.noreply.github.com>
Co-authored-by: Julius Brummack <133630819+jbrummack@users.noreply.github.com>
Co-authored-by: Julius Brummack <juliusbrummack@icloud.com>
Co-authored-by: Andrew Dirksen <2702854+bddap@users.noreply.github.com>
Co-authored-by: Christopher Yim <4638193+GoodKnight@users.noreply.github.com>
Co-authored-by: Britt <brittlewis12@gmail.com>
  • Loading branch information
21 people authored Aug 6, 2024
2 parents 5ea48c8 + 3b366ba commit 219141c
Show file tree
Hide file tree
Showing 60 changed files with 3,747 additions and 1,224 deletions.
46 changes: 39 additions & 7 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,38 @@ permissions:
contents: read

jobs:
versioning:
name: Update Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Run TinySemVer
uses: ashvardanian/tinysemver@v2.0.1
with:
verbose: "true"
version-file: "VERSION"
update-version-in: |
package.json:"version": "(\d+\.\d+\.\d+)"
CITATION.cff:^version: (\d+\.\d+\.\d+)
Cargo.toml:^version = "(\d+\.\d+\.\d+)"
wasmer.toml:^version = "(\d+\.\d+\.\d+)"
conanfile.py:version = "(\d+\.\d+\.\d+)"
java/README.md:<version>(\d+\.\d+\.\d+)</version>
README.md:version = {(\d+\.\d+\.\d+)}
csharp/nuget/nuget-package.props:>(\d+\.\d+\.\d+)</Version>
CMakeLists.txt:VERSION (\d+\.\d+\.\d+)
update-major-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_MAJOR (\d+)
update-minor-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_MINOR (\d+)
update-patch-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_PATCH (\d+)
dry-run: "true"

test_ubuntu_gcc:
name: Ubuntu (GCC 12)
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -75,9 +107,9 @@ jobs:

# Java
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "11"
java-version: "21"
distribution: "adopt"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
Expand All @@ -93,7 +125,7 @@ jobs:
run: |
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
cp "${{ github.workspace }}/build_artifacts/libusearch_c.so" "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
dotnet test -c Release
dotnet test -c Debug --logger "console;verbosity=detailed"
shell: bash
working-directory: ${{ github.workspace }}/csharp

Expand Down Expand Up @@ -168,7 +200,7 @@ jobs:
run: |
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
cp "${{ github.workspace }}/build_artifacts/libusearch_c.so" "${{ github.workspace }}/csharp/lib/runtimes/linux-x64/native"
dotnet test -c Release
dotnet test -c Debug --logger "console;verbosity=detailed"
shell: bash
working-directory: ${{ github.workspace }}/csharp

Expand Down Expand Up @@ -232,7 +264,7 @@ jobs:
run: |
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
cp "${{ github.workspace }}/build_artifacts/libusearch_c.dylib" "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
dotnet test -c Release
dotnet test -c Debug --logger "console;verbosity=detailed" --filter "FullyQualifiedName!=Cloud.Unum.USearch.Tests.UsearchIndexTests.PersistAndRestore"
shell: bash
working-directory: ${{ github.workspace }}/csharp

Expand Down Expand Up @@ -288,7 +320,7 @@ jobs:
run: |
mkdir -p "${{ github.workspace }}\csharp\lib\runtimes\win-x64\native"
cp "${{ github.workspace }}\build_artifacts\libusearch_c.dll" "${{ github.workspace }}\csharp\lib\runtimes\win-x64\native"
dotnet test -c Release
dotnet test -c Debug --logger "console;verbosity=detailed"
shell: bash
working-directory: ${{ github.workspace }}/csharp

Expand All @@ -299,7 +331,7 @@ jobs:
- uses: actions/checkout@v4
- run: git submodule update --init --recursive
- name: Build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: .
load: true
Expand Down
48 changes: 35 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,44 @@ permissions:

jobs:
versioning:
name: Semantic Release
runs-on: ubuntu-22.04
name: Update Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Bump version
run: npm install --save-dev --prefix ./package-ci @semantic-release/exec @semantic-release/git conventional-changelog-eslint semantic-release && npx --prefix ./package-ci semantic-release
- name: Run TinySemVer
uses: ashvardanian/tinysemver@v2.0.1
with:
verbose: "true"
version-file: "VERSION"
update-version-in: |
package.json:"version": "(\d+\.\d+\.\d+)"
CITATION.cff:^version: (\d+\.\d+\.\d+)
Cargo.toml:^version = "(\d+\.\d+\.\d+)"
wasmer.toml:^version = "(\d+\.\d+\.\d+)"
conanfile.py:version = "(\d+\.\d+\.\d+)"
java/README.md:<version>(\d+\.\d+\.\d+)</version>
README.md:version = {(\d+\.\d+\.\d+)}
csharp/nuget/nuget-package.props:>(\d+\.\d+\.\d+)</Version>
CMakeLists.txt:VERSION (\d+\.\d+\.\d+)
update-major-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_MAJOR (\d+)
update-minor-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_MINOR (\d+)
update-patch-version-in: |
include/usearch/index.hpp:^#define USEARCH_VERSION_PATCH (\d+)
dry-run: "false"
push: "true"
create-release: "true"
github-token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}

rebase:
name: Rebase Dev. Branch
Expand Down Expand Up @@ -469,7 +490,8 @@ jobs:
os:
- macos-latest
- ubuntu-22.04
- windows-latest
# Windows pre-buld is not working
# - windows-latest
exclude:
- arch: x86
os: macos-latest
Expand Down Expand Up @@ -614,9 +636,9 @@ jobs:
- name: Pull Git submodules
run: git submodule update --init --recursive
- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "11"
java-version: "21"
distribution: "adopt"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
Expand Down Expand Up @@ -678,7 +700,7 @@ jobs:
unum/usearch
ghcr.io/${{ github.repository }}
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
context: .
push: true
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/update_version.sh

This file was deleted.

10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ bin
.cache

# C++ builds
build
build_release
build_debug
build_artifacts
/build
/build_release
/build_debug
/build_relwithdebinfo
/build_profile
/build_artifacts
_deps
CMakeCache.txt
CMakeFiles
Expand Down
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@
"datasets/wiki_1M/groundtruth.public.100K.ibin",
],
"justMyCode": true
},
{
"name": "Unit Test C#",
"type": "coreclr",
"request": "launch",
"program": "dotnet",
"args": [
"test",
"-c",
"Debug"
],
"cwd": "${workspaceFolder}/csharp",
"stopAtEntry": false
}
]
}
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
"xutility": "cpp",
"execution": "cpp"
},
"cSpell.words": [
"allclose",
Expand All @@ -139,6 +140,7 @@
"dtype",
"DUSEARCH",
"emcmake",
"endregion",
"equi",
"equidimensional",
"FAISS",
Expand All @@ -151,6 +153,11 @@
"hnswlib",
"ibin",
"jaccard",
"Jemalloc",
"Kullback",
"Leibler",
"libjemalloc",
"libomp",
"libusearch",
"linalg",
"longlong",
Expand All @@ -174,10 +181,13 @@
"SLOC",
"Sonatype",
"sorensen",
"Sørensen",
"sqeuclidean",
"stringzilla",
"Struct",
"swar",
"tanimoto",
"tparam",
"tqdm",
"uninitialize",
"unumusearch",
Expand Down
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"tasks": [
{
"label": "Linux Build Debug",
"command": "cmake -DCMAKE_CXX_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1 -DCMAKE_BUILD_TYPE=Debug -B ./build_debug && cmake --build ./build_debug --config Debug",
"command": "cmake -DCMAKE_CXX_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1 -DCMAKE_BUILD_TYPE=Debug -B ./build_debug && cmake --build ./build_debug --config Debug",
"args": [],
"type": "shell",
"problemMatcher": [
Expand All @@ -12,7 +12,7 @@
},
{
"label": "Linux Build Release",
"command": "cmake -DCMAKE_CXX_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1 -DCMAKE_BUILD_TYPE=Release -B ./build_release && cmake --build ./build_release --config RelWithDebInfo",
"command": "cmake -DCMAKE_CXX_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12 -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1 -DCMAKE_BUILD_TYPE=Release -B ./build_release && cmake --build ./build_release --config RelWithDebInfo",
"args": [],
"type": "shell",
"problemMatcher": [
Expand Down
28 changes: 14 additions & 14 deletions BENCHMARKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ Within this repository you will find two commonly used utilities:
To achieve best highest results we suggest compiling locally for the target architecture.

```sh
cmake -B ./build_release -USEARCH_BUILD_BENCH_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1
cmake --build ./build_release --config Release -j
./build_release/bench_cpp --help
cmake -USEARCH_BUILD_BENCH_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build_profile
cmake --build build_profile --config RelWithDebInfo -j
build_profile/bench_cpp --help
```

Which would print the following instructions.

```txt
SYNOPSIS
./build_release/bench_cpp [--vectors <path>] [--queries <path>] [--neighbors <path>] [-b] [-j
<integer>] [-c <integer>] [--expansion-add <integer>]
[--expansion-search <integer>] [--native|--f16quant|--i8quant]
[--ip|--l2sq|--cos|--haversine] [-h]
build_profile/bench_cpp [--vectors <path>] [--queries <path>] [--neighbors <path>] [-b] [-j
<integer>] [-c <integer>] [--expansion-add <integer>]
[--expansion-search <integer>] [--native|--f16quant|--i8quant]
[--ip|--l2sq|--cos|--haversine] [-h]
OPTIONS
--vectors <path>
Expand Down Expand Up @@ -111,12 +111,12 @@ OPTIONS
Here is an example of running the C++ benchmark:

```sh
./build_release/bench_cpp \
build_profile/bench_cpp \
--vectors datasets/wiki_1M/base.1M.fbin \
--queries datasets/wiki_1M/query.public.100K.fbin \
--neighbors datasets/wiki_1M/groundtruth.public.100K.ibin

./build_release/bench_cpp \
build_profile/bench_cpp \
--vectors datasets/t2i_1B/base.1B.fbin \
--queries datasets/t2i_1B/query.public.100K.fbin \
--neighbors datasets/t2i_1B/groundtruth.public.100K.ibin \
Expand Down Expand Up @@ -201,17 +201,17 @@ With `perf`:

```sh
# Pass environment variables with `-E`, and `-d` for details
sudo -E perf stat -d ./build_release/bench_cpp ...
sudo -E perf mem -d ./build_release/bench_cpp ...
sudo -E perf stat -d build_profile/bench_cpp ...
sudo -E perf mem -d build_profile/bench_cpp ...
# Sample on-CPU functions for the specified command, at 1 Kilo Hertz:
sudo -E perf record -F 1000 ./build_release/bench_cpp ...
perf record -d -e arm_spe// -- ./build_release/bench_cpp ..
sudo -E perf record -F 1000 build_profile/bench_cpp ...
perf record -d -e arm_spe// -- build_profile/bench_cpp ..
```

### Caches

```sh
sudo perf stat -e 'faults,dTLB-loads,dTLB-load-misses,cache-misses,cache-references' ./build_release/bench_cpp ...
sudo perf stat -e 'faults,dTLB-loads,dTLB-load-misses,cache-misses,cache-references' build_profile/bench_cpp ...
```

Typical output on a 1M vectors dataset is:
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors:
given-names: "Ash"
orcid: "https://orcid.org/0000-0002-4882-1815"
title: "USearch by Unum Cloud"
version: 2.12.0
version: 2.13.0
doi: 10.5281/zenodo.7949416
date-released: 2023-10-22
url: "https://github.com/unum-cloud/usearch"
Loading

0 comments on commit 219141c

Please sign in to comment.