usearch 2.8.3 → 2.8.5
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.
- package/.github/workflows/release.yml +4 -2
- package/.vscode/settings.json +179 -179
- package/CITATION.cff +1 -1
- package/CONTRIBUTING.md +268 -6
- package/Cargo.toml +1 -1
- package/README.md +64 -59
- package/build.gradle +7 -9
- package/conanfile.py +1 -1
- package/cpp/README.md +89 -21
- package/csharp/DEV_SETUP.md +1 -1
- package/csharp/nuget/nuget-package.props +1 -1
- package/docs/{compilation.rst → contributing.rst} +2 -2
- package/docs/index.rst +1 -1
- package/include/usearch/index.hpp +1 -1
- package/include/usearch/index_dense.hpp +11 -7
- package/java/cloud/unum/usearch/Index.java +119 -53
- package/package.json +1 -1
- package/python/README.md +1 -1
- package/simsimd/CMakeLists.txt +1 -1
- package/simsimd/README.md +7 -1
- package/simsimd/include/simsimd/probability.h +24 -24
- package/simsimd/include/simsimd/types.h +8 -0
- package/simsimd/javascript/{test.js → test/simsimd.test.js} +15 -15
- package/simsimd/package.json +4 -8
- package/simsimd/setup.py +3 -0
- package/wasmer.toml +1 -1
- package/docs/compilation.md +0 -215
- package/simsimd/.clang-format +0 -10
- package/simsimd/.github/workflows/prerelease.yml +0 -89
- package/simsimd/.github/workflows/release.yml +0 -141
- package/simsimd/.github/workflows/update_version.sh +0 -5
- package/simsimd/.vscode/launch.json +0 -53
- package/simsimd/.vscode/settings.json +0 -114
- package/simsimd/.vscode/tasks.json +0 -23
- package/simsimd/go.mod +0 -3
- package/simsimd/golang/bench_test.go +0 -40
- package/simsimd/golang/simsimd.go +0 -47
- package/simsimd/golang/unit_test.go +0 -40
- package/simsimd/pyproject.toml +0 -42
- package/simsimd/python/bench.ipynb +0 -187
- package/simsimd/python/bench.py +0 -268
- package/simsimd/python/lib.c +0 -492
- package/simsimd/python/test.py +0 -195
|
@@ -474,13 +474,15 @@ jobs:
|
|
|
474
474
|
- name: Setup Gradle
|
|
475
475
|
uses: gradle/gradle-build-action@v2.4.2
|
|
476
476
|
- name: Execute Gradle build
|
|
477
|
-
run: gradle
|
|
477
|
+
run: gradle sign && gradle build
|
|
478
478
|
- name: Publish package
|
|
479
|
-
run: gradle publish
|
|
479
|
+
run: gradle publish
|
|
480
480
|
env:
|
|
481
481
|
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
|
|
482
482
|
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
|
|
483
483
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
484
|
+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
|
|
485
|
+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
|
|
484
486
|
|
|
485
487
|
publish_swift:
|
|
486
488
|
name: Publish ObjC & Swift
|
package/.vscode/settings.json
CHANGED
|
@@ -1,180 +1,180 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
2
|
+
"files.associations": {
|
|
3
|
+
"array": "cpp",
|
|
4
|
+
"atomic": "cpp",
|
|
5
|
+
"hash_map": "cpp",
|
|
6
|
+
"hash_set": "cpp",
|
|
7
|
+
"barrier": "cpp",
|
|
8
|
+
"bit": "cpp",
|
|
9
|
+
"*.tcc": "cpp",
|
|
10
|
+
"bitset": "cpp",
|
|
11
|
+
"cctype": "cpp",
|
|
12
|
+
"chrono": "cpp",
|
|
13
|
+
"cinttypes": "cpp",
|
|
14
|
+
"clocale": "cpp",
|
|
15
|
+
"cmath": "cpp",
|
|
16
|
+
"codecvt": "cpp",
|
|
17
|
+
"compare": "cpp",
|
|
18
|
+
"complex": "cpp",
|
|
19
|
+
"concepts": "cpp",
|
|
20
|
+
"condition_variable": "cpp",
|
|
21
|
+
"csignal": "cpp",
|
|
22
|
+
"cstdarg": "cpp",
|
|
23
|
+
"cstddef": "cpp",
|
|
24
|
+
"cstdint": "cpp",
|
|
25
|
+
"cstdio": "cpp",
|
|
26
|
+
"cstdlib": "cpp",
|
|
27
|
+
"cstring": "cpp",
|
|
28
|
+
"ctime": "cpp",
|
|
29
|
+
"cwchar": "cpp",
|
|
30
|
+
"cwctype": "cpp",
|
|
31
|
+
"deque": "cpp",
|
|
32
|
+
"forward_list": "cpp",
|
|
33
|
+
"list": "cpp",
|
|
34
|
+
"map": "cpp",
|
|
35
|
+
"set": "cpp",
|
|
36
|
+
"string": "cpp",
|
|
37
|
+
"unordered_map": "cpp",
|
|
38
|
+
"unordered_set": "cpp",
|
|
39
|
+
"vector": "cpp",
|
|
40
|
+
"exception": "cpp",
|
|
41
|
+
"algorithm": "cpp",
|
|
42
|
+
"functional": "cpp",
|
|
43
|
+
"iterator": "cpp",
|
|
44
|
+
"memory": "cpp",
|
|
45
|
+
"memory_resource": "cpp",
|
|
46
|
+
"numeric": "cpp",
|
|
47
|
+
"optional": "cpp",
|
|
48
|
+
"random": "cpp",
|
|
49
|
+
"ratio": "cpp",
|
|
50
|
+
"regex": "cpp",
|
|
51
|
+
"string_view": "cpp",
|
|
52
|
+
"system_error": "cpp",
|
|
53
|
+
"tuple": "cpp",
|
|
54
|
+
"type_traits": "cpp",
|
|
55
|
+
"utility": "cpp",
|
|
56
|
+
"fstream": "cpp",
|
|
57
|
+
"initializer_list": "cpp",
|
|
58
|
+
"iomanip": "cpp",
|
|
59
|
+
"iosfwd": "cpp",
|
|
60
|
+
"iostream": "cpp",
|
|
61
|
+
"istream": "cpp",
|
|
62
|
+
"limits": "cpp",
|
|
63
|
+
"mutex": "cpp",
|
|
64
|
+
"new": "cpp",
|
|
65
|
+
"numbers": "cpp",
|
|
66
|
+
"ostream": "cpp",
|
|
67
|
+
"semaphore": "cpp",
|
|
68
|
+
"sstream": "cpp",
|
|
69
|
+
"stdexcept": "cpp",
|
|
70
|
+
"stop_token": "cpp",
|
|
71
|
+
"streambuf": "cpp",
|
|
72
|
+
"thread": "cpp",
|
|
73
|
+
"typeindex": "cpp",
|
|
74
|
+
"typeinfo": "cpp",
|
|
75
|
+
"valarray": "cpp",
|
|
76
|
+
"variant": "cpp",
|
|
77
|
+
"__bit_reference": "cpp",
|
|
78
|
+
"__bits": "cpp",
|
|
79
|
+
"__config": "cpp",
|
|
80
|
+
"__debug": "cpp",
|
|
81
|
+
"__errc": "cpp",
|
|
82
|
+
"__hash_table": "cpp",
|
|
83
|
+
"__locale": "cpp",
|
|
84
|
+
"__mutex_base": "cpp",
|
|
85
|
+
"__node_handle": "cpp",
|
|
86
|
+
"__nullptr": "cpp",
|
|
87
|
+
"__split_buffer": "cpp",
|
|
88
|
+
"__string": "cpp",
|
|
89
|
+
"__threading_support": "cpp",
|
|
90
|
+
"__tree": "cpp",
|
|
91
|
+
"__tuple": "cpp",
|
|
92
|
+
"any": "cpp",
|
|
93
|
+
"ios": "cpp",
|
|
94
|
+
"locale": "cpp",
|
|
95
|
+
"queue": "cpp",
|
|
96
|
+
"stack": "cpp",
|
|
97
|
+
"__memory": "cpp",
|
|
98
|
+
"filesystem": "cpp",
|
|
99
|
+
"__availability": "cpp",
|
|
100
|
+
"version": "cpp",
|
|
101
|
+
"future": "cpp",
|
|
102
|
+
"__verbose_abort": "cpp",
|
|
103
|
+
"shared_mutex": "cpp",
|
|
104
|
+
"ranges": "cpp",
|
|
105
|
+
"span": "cpp",
|
|
106
|
+
"format": "cpp",
|
|
107
|
+
"charconv": "cpp"
|
|
108
|
+
},
|
|
109
|
+
"cSpell.words": [
|
|
110
|
+
"allclose",
|
|
111
|
+
"arange",
|
|
112
|
+
"astype",
|
|
113
|
+
"Availible",
|
|
114
|
+
"bidict",
|
|
115
|
+
"BLAS",
|
|
116
|
+
"Cdecl",
|
|
117
|
+
"cflags",
|
|
118
|
+
"cibuildwheel",
|
|
119
|
+
"citerator",
|
|
120
|
+
"downcasted",
|
|
121
|
+
"Downcasting",
|
|
122
|
+
"dtype",
|
|
123
|
+
"DUSEARCH",
|
|
124
|
+
"emcmake",
|
|
125
|
+
"equi",
|
|
126
|
+
"equidimensional",
|
|
127
|
+
"FAISS",
|
|
128
|
+
"fbin",
|
|
129
|
+
"groundtruth",
|
|
130
|
+
"hashable",
|
|
131
|
+
"HNSW",
|
|
132
|
+
"hnswlib",
|
|
133
|
+
"ibin",
|
|
134
|
+
"jaccard",
|
|
135
|
+
"libusearch",
|
|
136
|
+
"linalg",
|
|
137
|
+
"longlong",
|
|
138
|
+
"memmap",
|
|
139
|
+
"Napi",
|
|
140
|
+
"ndarray",
|
|
141
|
+
"ndim",
|
|
142
|
+
"Numba",
|
|
143
|
+
"numpy",
|
|
144
|
+
"OPENMP",
|
|
145
|
+
"preprocess",
|
|
146
|
+
"Println",
|
|
147
|
+
"pytest",
|
|
148
|
+
"Quickstart",
|
|
149
|
+
"rtype",
|
|
150
|
+
"SIMD",
|
|
151
|
+
"simsimd",
|
|
152
|
+
"SLOC",
|
|
153
|
+
"Sonatype",
|
|
154
|
+
"sorensen",
|
|
155
|
+
"Struct",
|
|
156
|
+
"tanimoto",
|
|
157
|
+
"tqdm",
|
|
158
|
+
"uninitialize",
|
|
159
|
+
"unumusearch",
|
|
160
|
+
"usearch",
|
|
161
|
+
"usecases",
|
|
162
|
+
"Vardanian",
|
|
163
|
+
"vectorize",
|
|
164
|
+
"Xunit"
|
|
165
|
+
],
|
|
166
|
+
"autoDocstring.docstringFormat": "sphinx",
|
|
167
|
+
"java.configuration.updateBuildConfiguration": "interactive",
|
|
168
|
+
"python.testing.pytestArgs": ["python"],
|
|
169
|
+
"python.analysis.diagnosticSeverityOverrides": {
|
|
170
|
+
"reportMissingImports": "none"
|
|
171
|
+
},
|
|
172
|
+
"python.testing.unittestEnabled": false,
|
|
173
|
+
"python.testing.pytestEnabled": true,
|
|
174
|
+
"[go]": {
|
|
175
|
+
"editor.insertSpaces": true,
|
|
176
|
+
"editor.formatOnSave": true,
|
|
177
|
+
"editor.defaultFormatter": "golang.go"
|
|
178
|
+
},
|
|
179
|
+
"dotnet.defaultSolution": "csharp/Cloud.Unum.USearch.sln"
|
|
180
|
+
}
|
package/CITATION.cff
CHANGED
package/CONTRIBUTING.md
CHANGED
|
@@ -1,12 +1,274 @@
|
|
|
1
1
|
# Contribution Guide
|
|
2
2
|
|
|
3
|
-
Thank you for
|
|
4
|
-
It's always nice to have third-party contributors
|
|
3
|
+
Thank you for coming here!
|
|
4
|
+
It's always nice to have third-party contributors 🤗
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
To keep the quality of the code high, we have a set of guidelines common to all Unum projects.
|
|
8
|
+
To keep the quality of the code high, we have a set of guidelines common to [all Unum projects](https://github.com/unum-cloud).
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
- How to organize branches?
|
|
12
|
-
- How to style commits?
|
|
10
|
+
- [What's the procedure?](https://github.com/unum-cloud/awesome/blob/main/Workflow.md#organizing-software-development)
|
|
11
|
+
- [How to organize branches?](https://github.com/unum-cloud/awesome/blob/main/Workflow.md#branches)
|
|
12
|
+
- [How to style commits?](https://github.com/unum-cloud/awesome/blob/main/Workflow.md#commits)
|
|
13
|
+
|
|
14
|
+
## Before you start
|
|
15
|
+
|
|
16
|
+
Before building the first time, please pull `git` submodules.
|
|
17
|
+
That's how we bring in SimSIMD and other optional dependencies to test all of the available functionality.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
git submodule update --init --recursive
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## C++ 11 and C 99
|
|
24
|
+
|
|
25
|
+
Our primary C++ implementation uses CMake for builds.
|
|
26
|
+
If this is your first experience with CMake, use the following commands to get started:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
sudo apt-get update && sudo apt-get install cmake build-essential libjemalloc-dev g++-12 gcc-12 # Ubuntu
|
|
30
|
+
brew install libomp llvm # MacOS
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Using modern syntax, this is how you build and run the test suite:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
cmake -DUSEARCH_BUILD_TEST_CPP=1 -B ./build_debug
|
|
37
|
+
cmake --build ./build_debug --config Debug
|
|
38
|
+
./build_debug/test_cpp
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The CMakeLists.txt file has a number of options you can pass:
|
|
42
|
+
|
|
43
|
+
- What to build:
|
|
44
|
+
- `USEARCH_BUILD_TEST_CPP` - build the C++ test suite
|
|
45
|
+
- `USEARCH_BUILD_BENCH_CPP` - build the C++ benchmark suite
|
|
46
|
+
- `USEARCH_BUILD_LIB_C` - build the C library
|
|
47
|
+
- `USEARCH_BUILD_TEST_C` - build the C test suite
|
|
48
|
+
- Which dependencies to use:
|
|
49
|
+
- `USEARCH_USE_OPENMP` - use OpenMP for parallelism
|
|
50
|
+
- `USEARCH_USE_SIMSIMD` - use SimSIMD for vectorization
|
|
51
|
+
- `USEARCH_USE_JEMALLOC` - use Jemalloc for memory management
|
|
52
|
+
- `USEARCH_USE_NATIVE_F16` - use native half-precision floating point
|
|
53
|
+
|
|
54
|
+
Putting all of this together on Ubuntu and compiling the "release" version using the GCC 12 compiler:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
cmake \
|
|
58
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
59
|
+
-DCMAKE_C_COMPILER=gcc-12 \
|
|
60
|
+
-DCMAKE_CXX_COMPILER=g++-12 \
|
|
61
|
+
-DUSEARCH_USE_NATIVE_F16=1 \
|
|
62
|
+
-DUSEARCH_USE_OPENMP=1 \
|
|
63
|
+
-DUSEARCH_USE_SIMSIMD=1 \
|
|
64
|
+
-DUSEARCH_USE_JEMALLOC=1 \
|
|
65
|
+
-DUSEARCH_BUILD_TEST_CPP=1 \
|
|
66
|
+
-DUSEARCH_BUILD_BENCH_CPP=1 \
|
|
67
|
+
-DUSEARCH_BUILD_LIB_C=1 \
|
|
68
|
+
-DUSEARCH_BUILD_TEST_C=1 \
|
|
69
|
+
-B ./build_release
|
|
70
|
+
|
|
71
|
+
cmake --build ./build_release --config Release
|
|
72
|
+
./build_release/test_cpp
|
|
73
|
+
./build_release/test_c
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Similarly, to use the most recent Clang compiler version from HomeBrew on MacOS:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
cmake \
|
|
80
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
81
|
+
-DCMAKE_C_COMPILER="/opt/homebrew/opt/llvm/bin/clang" \
|
|
82
|
+
-DCMAKE_CXX_COMPILER="/opt/homebrew/opt/llvm/bin/clang++" \
|
|
83
|
+
-DUSEARCH_USE_NATIVE_F16=1 \
|
|
84
|
+
-DUSEARCH_USE_OPENMP=1 \
|
|
85
|
+
-DUSEARCH_USE_SIMSIMD=1 \
|
|
86
|
+
-DUSEARCH_USE_JEMALLOC=1 \
|
|
87
|
+
-DUSEARCH_BUILD_TEST_CPP=1 \
|
|
88
|
+
-DUSEARCH_BUILD_BENCH_CPP=1 \
|
|
89
|
+
-DUSEARCH_BUILD_LIB_C=1 \
|
|
90
|
+
-DUSEARCH_BUILD_TEST_C=1 \
|
|
91
|
+
-B ./build_release
|
|
92
|
+
|
|
93
|
+
cmake --build ./build_release --config Release
|
|
94
|
+
./build_release/test_cpp
|
|
95
|
+
./build_release/test_c
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Linting:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
cppcheck --enable=all --force --suppress=cstyleCast --suppress=unusedFunction \
|
|
102
|
+
include/usearch/index.hpp \
|
|
103
|
+
include/index_dense.hpp \
|
|
104
|
+
include/index_plugins.hpp
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Python 3
|
|
108
|
+
|
|
109
|
+
Python bindings are built using PyBind11 and are available on [PyPi](https://pypi.org/project/usearch/).
|
|
110
|
+
The compilation settings are controlled by the `setup.py` and are independent from CMake used for C/C++ builds.
|
|
111
|
+
Use PyTest to validate the build.
|
|
112
|
+
|
|
113
|
+
- The `-s` option will disable capturing the logs.
|
|
114
|
+
- The `-x` option will exit after first failure to simplify debugging.
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
pip install -e . && pytest python/scripts/ -s -x
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Linting:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
pip install ruff
|
|
124
|
+
ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 python
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Before merging your changes you may want to test your changes against the entire matrix of Python versions USearch supports.
|
|
128
|
+
For that you need the `cibuildwheel`, which is tricky to use on MacOS and Windows, as it would target just the local environment.
|
|
129
|
+
Still, if you have Docker running on any desktop OS, you can use it to build and test the Python bindings for all Python versions for Linux:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
pip install cibuildwheel
|
|
133
|
+
cibuildwheel --platform linux
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## JavaScript
|
|
137
|
+
|
|
138
|
+
USearch provides NAPI bindings for NodeJS available on [NPM](https://www.npmjs.com/package/usearch).
|
|
139
|
+
The compilation settings are controlled by the `binding.gyp` and are independent from CMake used for C/C++ builds.
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
npm install
|
|
143
|
+
node --test ./javascript/usearch.test.js
|
|
144
|
+
npm publish
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
To compile to WebAssembly make sure you have `emscripten` installed and run the following script:
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
emcmake cmake -B ./build -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -s TOTAL_MEMORY=64MB" && emmake make -C ./build
|
|
151
|
+
node ./build/usearch.test.js
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
If you don't yet have `emcmake` installed:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
git clone https://github.com/emscripten-core/emsdk.git && ./emsdk/emsdk install latest && ./emsdk/emsdk activate latest && source ./emsdk/emsdk_env.sh
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Rust
|
|
161
|
+
|
|
162
|
+
USearch provides Rust bindings available on [Crates.io](https://crates.io/crates/usearch).
|
|
163
|
+
The compilation settings are controlled by the `build.rs` and are independent from CMake used for C/C++ builds.
|
|
164
|
+
|
|
165
|
+
```sh
|
|
166
|
+
cargo test -p usearch
|
|
167
|
+
cargo publish
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Objective-C and Swift
|
|
171
|
+
|
|
172
|
+
USearch provides both Objective-C and Swift bindings through the [Swift Package Manager](https://swiftpackageindex.com/unum-cloud/usearch).
|
|
173
|
+
The compilation settings are controlled by the `Package.swift` and are independent from CMake used for C/C++ builds.
|
|
174
|
+
|
|
175
|
+
```sh
|
|
176
|
+
swift build
|
|
177
|
+
swift test -v
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## GoLang
|
|
181
|
+
|
|
182
|
+
USearch provides GoLang bindings, that depend on the C library that must be installed beforehand.
|
|
183
|
+
So one should first compile the C library, link it with GoLang, and only then run tests.
|
|
184
|
+
|
|
185
|
+
```sh
|
|
186
|
+
cmake -B ./build_release -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1
|
|
187
|
+
cmake --build ./build_release --config Release -j
|
|
188
|
+
|
|
189
|
+
mv ./c/libusearch_c.so ./golang/ # or .dylib to install the library on MacOS
|
|
190
|
+
cp ./c/usearch.h ./golang/ # to make the header available to GoLang
|
|
191
|
+
|
|
192
|
+
cd golang && go test -v ; cd ..
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Java
|
|
196
|
+
|
|
197
|
+
USearch provides Java bindings available from the [GitHub Maven registry](https://github.com/unum-cloud/usearch/packages/1867475) and the [Sonatype Maven Central Repository](https://central.sonatype.com/artifact/cloud.unum/usearch).
|
|
198
|
+
The compilation settings are controlled by the `build.gradle` and are independent from CMake used for C/C++ builds.
|
|
199
|
+
|
|
200
|
+
To setup the Gradle environment:
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
sudo apt get install zip unzip
|
|
204
|
+
curl -s "https://get.sdkman.io" | bash
|
|
205
|
+
sdk install java gradle
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Afterwards, in a new terminal:
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
gradle clean build
|
|
212
|
+
java -cp . -Djava.library.path="$(pwd)/build/libs/usearch/shared" java/cloud/unum/usearch/Index.java
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Or step by-step:
|
|
216
|
+
|
|
217
|
+
```sh
|
|
218
|
+
cs java/unum/cloud/usearch
|
|
219
|
+
javac -h . Index.java
|
|
220
|
+
|
|
221
|
+
# Ubuntu:
|
|
222
|
+
g++ -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux cloud_unum_usearch_Index.cpp -o cloud_unum_usearch_Index.o
|
|
223
|
+
g++ -shared -fPIC -o libusearch_c.so cloud_unum_usearch_Index.o -lc
|
|
224
|
+
|
|
225
|
+
# Windows
|
|
226
|
+
g++ -c -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 cloud_unum_usearch_Index.cpp -o cloud_unum_usearch_Index.o
|
|
227
|
+
g++ -shared -o USearchJNI.dll cloud_unum_usearch_Index.o -Wl,--add-stdcall-alias
|
|
228
|
+
|
|
229
|
+
# MacOS
|
|
230
|
+
g++ -std=c++11 -c -fPIC \
|
|
231
|
+
-I../../../../include \
|
|
232
|
+
-I../../../../fp16/include \
|
|
233
|
+
-I../../../../simsimd/include \
|
|
234
|
+
-I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin cloud_unum_usearch_Index.cpp -o cloud_unum_usearch_Index.o
|
|
235
|
+
g++ -dynamiclib -o libusearch.dylib cloud_unum_usearch_Index.o -lc
|
|
236
|
+
# Run linking to that directory
|
|
237
|
+
java -cp . -Djava.library.path="$(pwd)/java/cloud/unum/usearch/" Index.java
|
|
238
|
+
java -cp . -Djava.library.path="$(pwd)/java" cloud.unum.usearch.Index
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Wolfram
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
brew install --cask wolfram-engine
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Docker
|
|
248
|
+
|
|
249
|
+
```sh
|
|
250
|
+
docker build -t unum/usearch . && docker run unum/usearch
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
For multi-architecture builds and publications:
|
|
254
|
+
|
|
255
|
+
```sh
|
|
256
|
+
version=$(cat VERSION)
|
|
257
|
+
docker buildx create --use &&
|
|
258
|
+
docker login &&
|
|
259
|
+
docker buildx build \
|
|
260
|
+
--platform "linux/amd64,linux/arm64" \
|
|
261
|
+
--build-arg version=$version \
|
|
262
|
+
--file Dockerfile \
|
|
263
|
+
--tag unum/usearch:$version \
|
|
264
|
+
--tag unum/usearch:latest \
|
|
265
|
+
--push .
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Working on Sub-Modules
|
|
269
|
+
|
|
270
|
+
Extending metrics in SimSIMD:
|
|
271
|
+
|
|
272
|
+
```sh
|
|
273
|
+
git push --set-upstream https://github.com/ashvardanian/simsimd.git HEAD:main
|
|
274
|
+
```
|