usearch 2.9.2 → 2.10.1

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.
Files changed (172) hide show
  1. package/README.md +39 -38
  2. package/javascript/{types → dist/cjs}/usearch.d.ts +90 -115
  3. package/javascript/dist/cjs/usearch.js +531 -0
  4. package/javascript/dist/esm/usearch.d.ts +212 -0
  5. package/javascript/{usearch.js → dist/esm/usearch.js} +199 -153
  6. package/package.json +25 -23
  7. package/prebuilds/darwin-arm64+x64/usearch.node +0 -0
  8. package/prebuilds/linux-arm64/usearch.node +0 -0
  9. package/prebuilds/linux-x64/usearch.node +0 -0
  10. package/prebuilds/win32-ia32/usearch.node +0 -0
  11. package/prebuilds/win32-x64/usearch.node +0 -0
  12. package/.clang-format +0 -10
  13. package/.clang-tidy +0 -60
  14. package/.cmake-format.py +0 -19
  15. package/.dockerignore +0 -93
  16. package/.gitattributes +0 -9
  17. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -90
  18. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  19. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -64
  20. package/.github/workflows/Dockerfile.libs +0 -36
  21. package/.github/workflows/prerelease.yml +0 -331
  22. package/.github/workflows/release.yml +0 -722
  23. package/.github/workflows/update_version.sh +0 -15
  24. package/.gitmodules +0 -9
  25. package/.releaserc +0 -90
  26. package/CITATION.cff +0 -11
  27. package/CMakeLists.txt +0 -324
  28. package/CODE_OF_CONDUCT.md +0 -128
  29. package/CONTRIBUTING.md +0 -361
  30. package/Cargo.toml +0 -19
  31. package/Dockerfile +0 -16
  32. package/VERSION +0 -1
  33. package/assets/unum.png +0 -0
  34. package/assets/usearch-approaches-transparent.png +0 -0
  35. package/assets/usearch-approaches-white.png +0 -0
  36. package/assets/usearch-neighbor-types.png +0 -0
  37. package/binding.gyp +0 -87
  38. package/build.gradle +0 -204
  39. package/build.rs +0 -18
  40. package/c/CMakeLists.txt +0 -25
  41. package/c/README.md +0 -34
  42. package/c/lib.cpp +0 -358
  43. package/c/test.c +0 -382
  44. package/c/usearch.h +0 -311
  45. package/cmake/clipp.cmake +0 -7
  46. package/cmake/config.cmake.in +0 -15
  47. package/cmake/emscripten.cmake +0 -8
  48. package/cmake/jemalloc.cmake +0 -62
  49. package/cmake/pkg-config.pc.in +0 -4
  50. package/cmake/usearchConfigVersion.cmake.in +0 -20
  51. package/conanfile.py +0 -26
  52. package/cpp/CMakeLists.txt +0 -14
  53. package/cpp/README.md +0 -161
  54. package/cpp/bench.cpp +0 -618
  55. package/cpp/test.cpp +0 -323
  56. package/fp16/CMakeLists.txt +0 -176
  57. package/fp16/LICENSE +0 -11
  58. package/fp16/README.md +0 -20
  59. package/fp16/bench/alt-element.cc +0 -89
  60. package/fp16/bench/from-alt-array.cc +0 -175
  61. package/fp16/bench/from-ieee-array.cc +0 -399
  62. package/fp16/bench/ieee-element.cc +0 -272
  63. package/fp16/bench/to-alt-array.cc +0 -91
  64. package/fp16/bench/to-ieee-array.cc +0 -303
  65. package/fp16/cmake/DownloadGoogleBenchmark.cmake +0 -15
  66. package/fp16/cmake/DownloadGoogleTest.cmake +0 -15
  67. package/fp16/cmake/DownloadPSimd.cmake +0 -15
  68. package/fp16/configure.py +0 -65
  69. package/fp16/confu.yaml +0 -8
  70. package/fp16/include/fp16/__init__.py +0 -0
  71. package/fp16/include/fp16/avx.py +0 -50
  72. package/fp16/include/fp16/avx2.py +0 -53
  73. package/fp16/include/fp16/bitcasts.h +0 -92
  74. package/fp16/include/fp16/fp16.h +0 -451
  75. package/fp16/include/fp16/psimd.h +0 -131
  76. package/fp16/include/fp16.h +0 -11
  77. package/fp16/jni/Android.mk +0 -6
  78. package/fp16/jni/Application.mk +0 -4
  79. package/fp16/test/alt-from-fp32-value.cc +0 -498
  80. package/fp16/test/alt-to-fp32-bits.cc +0 -263
  81. package/fp16/test/alt-to-fp32-psimd.cc +0 -145
  82. package/fp16/test/alt-to-fp32-value.cc +0 -348
  83. package/fp16/test/alt-to-fp32x2-psimd.cc +0 -245
  84. package/fp16/test/bitcasts.cc +0 -56
  85. package/fp16/test/ieee-from-fp32-value.cc +0 -523
  86. package/fp16/test/ieee-to-fp32-bits.cc +0 -333
  87. package/fp16/test/ieee-to-fp32-psimd.cc +0 -312
  88. package/fp16/test/ieee-to-fp32-value.cc +0 -420
  89. package/fp16/test/ieee-to-fp32x2-psimd.cc +0 -541
  90. package/fp16/test/peachpy/alt-xmm-to-fp32-xmm-avx.cc +0 -96
  91. package/fp16/test/peachpy/alt-xmm-to-fp32-ymm-avx2.cc +0 -96
  92. package/fp16/test/peachpy/stubs.py +0 -38
  93. package/fp16/test/tables.cc +0 -530
  94. package/fp16/test/tables.h +0 -13
  95. package/fp16/third-party/THHalf.h +0 -92
  96. package/fp16/third-party/eigen-half.h +0 -170
  97. package/fp16/third-party/float16-compressor.h +0 -80
  98. package/fp16/third-party/half.hpp +0 -2916
  99. package/fp16/third-party/npy-halffloat.h +0 -328
  100. package/include/usearch/index.hpp +0 -3836
  101. package/include/usearch/index_dense.hpp +0 -2004
  102. package/include/usearch/index_plugins.hpp +0 -2213
  103. package/javascript/lib.cpp +0 -341
  104. package/javascript/types/usearch.d.ts.map +0 -1
  105. package/javascript/usearch.test.js +0 -74
  106. package/package-ci.json +0 -10
  107. package/pyproject.toml +0 -51
  108. package/setup.py +0 -201
  109. package/simsimd/.releaserc +0 -86
  110. package/simsimd/CONTRIBUTING.md +0 -88
  111. package/simsimd/Cargo.lock +0 -709
  112. package/simsimd/Cargo.toml +0 -44
  113. package/simsimd/LICENSE +0 -201
  114. package/simsimd/README.md +0 -317
  115. package/simsimd/binding.gyp +0 -36
  116. package/simsimd/build.rs +0 -20
  117. package/simsimd/include/simsimd/binary.h +0 -245
  118. package/simsimd/include/simsimd/complex.h +0 -174
  119. package/simsimd/include/simsimd/probability.h +0 -548
  120. package/simsimd/include/simsimd/simsimd.h +0 -465
  121. package/simsimd/include/simsimd/spatial.h +0 -1267
  122. package/simsimd/include/simsimd/types.h +0 -208
  123. package/simsimd/javascript/bench.js +0 -127
  124. package/simsimd/javascript/fallback.ts +0 -193
  125. package/simsimd/javascript/lib.c +0 -102
  126. package/simsimd/javascript/node-gyp-build.d.ts +0 -1
  127. package/simsimd/javascript/simsimd.ts +0 -124
  128. package/simsimd/javascript/test.mjs +0 -153
  129. package/simsimd/javascript/tsconfig-base.json +0 -25
  130. package/simsimd/javascript/tsconfig-cjs.json +0 -8
  131. package/simsimd/javascript/tsconfig-esm.json +0 -8
  132. package/simsimd/package-lock.json +0 -1688
  133. package/simsimd/package.json +0 -61
  134. package/simsimd/rust/benches/cosine.rs +0 -27
  135. package/simsimd/rust/benches/native.rs +0 -30
  136. package/simsimd/rust/benches/sqeuclidean.rs +0 -27
  137. package/simsimd/rust/lib.c +0 -45
  138. package/simsimd/rust/lib.rs +0 -550
  139. package/sqlite/README.md +0 -178
  140. package/sqlite/lib.cpp +0 -325
  141. package/stringzilla/CONTRIBUTING.md +0 -446
  142. package/stringzilla/Cargo.lock +0 -25
  143. package/stringzilla/Cargo.toml +0 -26
  144. package/stringzilla/LICENSE +0 -201
  145. package/stringzilla/README.md +0 -1422
  146. package/stringzilla/VERSION +0 -1
  147. package/stringzilla/assets/cover-strinzilla.jpeg +0 -0
  148. package/stringzilla/assets/meme-stringzilla-v2.jpeg +0 -0
  149. package/stringzilla/assets/meme-stringzilla-v3.jpeg +0 -0
  150. package/stringzilla/binding.gyp +0 -16
  151. package/stringzilla/build.rs +0 -87
  152. package/stringzilla/c/lib.c +0 -337
  153. package/stringzilla/cli/README.md +0 -65
  154. package/stringzilla/cli/__init__.py +0 -0
  155. package/stringzilla/cli/split.py +0 -105
  156. package/stringzilla/cli/wc.py +0 -117
  157. package/stringzilla/include/stringzilla/experimental.h +0 -845
  158. package/stringzilla/include/stringzilla/module.modulemap +0 -9
  159. package/stringzilla/include/stringzilla/stringzilla.h +0 -5370
  160. package/stringzilla/include/stringzilla/stringzilla.hpp +0 -3838
  161. package/stringzilla/javascript/lib.c +0 -125
  162. package/stringzilla/javascript/stringzilla.js +0 -22
  163. package/stringzilla/package-ci.json +0 -10
  164. package/stringzilla/package.json +0 -32
  165. package/stringzilla/rust/lib.rs +0 -873
  166. package/stringzilla/swift/StringProtocol+StringZilla.swift +0 -280
  167. package/stringzilla/swift/Test.swift +0 -60
  168. package/tsconfig.json +0 -21
  169. package/wasmer.toml +0 -12
  170. package/winlibinstaller.bat +0 -42
  171. /package/{simsimd/javascript/dist-package-cjs.json → javascript/dist/cjs/package.json} +0 -0
  172. /package/{simsimd/javascript/dist-package-esm.json → javascript/dist/esm/package.json} +0 -0
package/CONTRIBUTING.md DELETED
@@ -1,361 +0,0 @@
1
- # Contribution Guide
2
-
3
- Thank you for coming here!
4
- It's always nice to have third-party contributors 🤗
5
-
6
- ---
7
-
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
-
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_FP16LIB` - use software emulation for 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_FP16LIB=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_FP16LIB=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
- I'd recommend putting the following breakpoints when debugging the code in GDB:
108
-
109
- - `__asan::ReportGenericError` - to detect illegal memory accesses.
110
- - `__ubsan::ScopedReport::~ScopedReport` - to catch undefined behavior.
111
- - `__GI_exit` - to stop at exit points - the end of running any executable.
112
- - `__builtin_unreachable` - to catch all the places where the code is expected to be unreachable.
113
-
114
- ## Python 3
115
-
116
- Python bindings are built using PyBind11 and are available on [PyPi](https://pypi.org/project/usearch/).
117
- The compilation settings are controlled by the `setup.py` and are independent from CMake used for C/C++ builds.
118
- Use PyTest to validate the build.
119
-
120
- - The `-s` option will disable capturing the logs.
121
- - The `-x` option will exit after first failure to simplify debugging.
122
-
123
- ```sh
124
- pip install -e . && pytest python/scripts/ -s -x
125
- ```
126
-
127
- Linting:
128
-
129
- ```sh
130
- pip install ruff
131
- ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 python
132
- ```
133
-
134
- Before merging your changes you may want to test your changes against the entire matrix of Python versions USearch supports.
135
- For that you need the `cibuildwheel`, which is tricky to use on MacOS and Windows, as it would target just the local environment.
136
- 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:
137
-
138
- ```sh
139
- pip install cibuildwheel
140
- cibuildwheel
141
- cibuildwheel --platform linux # works on any OS and builds all Linux backends
142
- cibuildwheel --platform linux --archs x86_64 # 64-bit x86, the most common on desktop and servers
143
- cibuildwheel --platform linux --archs aarch64 # 64-bit Arm for mobile devices, Apple M-series, and AWS Graviton
144
- cibuildwheel --platform linux --archs i686 # 32-bit Linux
145
- cibuildwheel --platform linux --archs s390x # emulating big-endian IBM Z
146
- cibuildwheel --platform macos # works only on MacOS
147
- cibuildwheel --platform windows # works only on Windows
148
- ```
149
-
150
- You may need root previligies for multi-architecture builds:
151
-
152
- ```sh
153
- sudo $(which cibuildwheel) --platform linux
154
- ```
155
-
156
- On Windows and MacOS, to avoid frequent path resolution issues, you may want to use:
157
-
158
- ```sh
159
- python -m cibuildwheel --platform windows
160
- ```
161
-
162
- ## JavaScript
163
-
164
- USearch provides NAPI bindings for NodeJS available on [NPM](https://www.npmjs.com/package/usearch).
165
- The compilation settings are controlled by the `binding.gyp` and are independent from CMake used for C/C++ builds.
166
-
167
- ```sh
168
- npm install
169
- node --test ./javascript/usearch.test.js
170
- npm publish
171
- ```
172
-
173
- To compile for AWS Lambda you'd need to recompile the binding.
174
- You can test the setup locally, overriding some of the compilation variables in Docker image:
175
-
176
- ```Dockerfile
177
- FROM public.ecr.aws/lambda/nodejs:18-x86_64
178
- RUN npm init -y
179
- RUN yum install tar git python3 cmake gcc-c++ -y && yum groupinstall "Development Tools" -y
180
-
181
- # Assuming AWS Linux 2 uses old compilers:
182
- ENV USEARCH_USE_FP16LIB 1
183
- ENV DUSEARCH_USE_SIMSIMD 1
184
- ENV SIMSIMD_TARGET_X86_AVX2 1
185
- ENV SIMSIMD_TARGET_X86_AVX512 0
186
- ENV SIMSIMD_TARGET_ARM_NEON 1
187
- ENV SIMSIMD_TARGET_ARM_SVE 0
188
-
189
- # For specific PR:
190
- # RUN npm install --build-from-source unum-cloud/usearch#pull/302/head
191
- # For specific version:
192
- # RUN npm install --build-from-source usearch@2.8.8
193
- RUN npm install --build-from-source usearch
194
- ```
195
-
196
- To compile to WebAssembly make sure you have `emscripten` installed and run the following script:
197
-
198
- ```sh
199
- emcmake cmake -B ./build -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -s TOTAL_MEMORY=64MB" && emmake make -C ./build
200
- node ./build/usearch.test.js
201
- ```
202
-
203
- If you don't yet have `emcmake` installed:
204
-
205
- ```sh
206
- git clone https://github.com/emscripten-core/emsdk.git && ./emsdk/emsdk install latest && ./emsdk/emsdk activate latest && source ./emsdk/emsdk_env.sh
207
- ```
208
-
209
- ## Rust
210
-
211
- USearch provides Rust bindings available on [Crates.io](https://crates.io/crates/usearch).
212
- The compilation settings are controlled by the `build.rs` and are independent from CMake used for C/C++ builds.
213
-
214
- ```sh
215
- cargo test -p usearch
216
- cargo publish
217
- ```
218
-
219
- ## Objective-C and Swift
220
-
221
- USearch provides both Objective-C and Swift bindings through the [Swift Package Manager](https://swiftpackageindex.com/unum-cloud/usearch).
222
- The compilation settings are controlled by the `Package.swift` and are independent from CMake used for C/C++ builds.
223
-
224
- ```sh
225
- swift build && swift test -v
226
- ```
227
-
228
- Those depend on Apple's `Foundation` library and can only run on Apple devices.
229
-
230
- ## GoLang
231
-
232
- USearch provides GoLang bindings, that depend on the C library that must be installed beforehand.
233
- So one should first compile the C library, link it with GoLang, and only then run tests.
234
-
235
- ```sh
236
- cmake -B ./build_release -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1
237
- cmake --build ./build_release --config Release -j
238
-
239
- mv ./c/libusearch_c.so ./golang/ # or .dylib to install the library on MacOS
240
- cp ./c/usearch.h ./golang/ # to make the header available to GoLang
241
-
242
- cd golang && go test -v ; cd ..
243
- ```
244
-
245
- ## Java
246
-
247
- 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).
248
- The compilation settings are controlled by the `build.gradle` and are independent from CMake used for C/C++ builds.
249
-
250
- To setup the Gradle environment:
251
-
252
- ```sh
253
- sudo apt get install zip unzip
254
- curl -s "https://get.sdkman.io" | bash
255
- sdk install java gradle
256
- ```
257
-
258
- Afterwards, in a new terminal:
259
-
260
- ```sh
261
- gradle clean build
262
- gradle test
263
- ```
264
-
265
- Alternatively, to run the `Index.main`:
266
-
267
- ```sh
268
- java -cp "$(pwd)/build/classes/java/main" -Djava.library.path="$(pwd)/build/libs/usearch/shared" java/cloud/unum/usearch/Index.java
269
- ```
270
-
271
- Or step by-step:
272
-
273
- ```sh
274
- cd java/cloud/unum/usearch
275
- javac -h . Index.java NativeUtils.java
276
-
277
- # Ensure JAVA_HOME system environment variable has been set
278
- # e.g. export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
279
-
280
- # Ubuntu:
281
- g++ -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux -I../../../../include cloud_unum_usearch_Index.cpp -o cloud_unum_usearch_Index.o
282
- g++ -shared -fPIC -o libusearch.so cloud_unum_usearch_Index.o -lc
283
-
284
- # Windows
285
- g++ -c -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 cloud_unum_usearch_Index.cpp -I..\..\..\..\include -o cloud_unum_usearch_Index.o
286
- g++ -shared -o USearchJNI.dll cloud_unum_usearch_Index.o -Wl,--add-stdcall-alias
287
-
288
- # MacOS
289
- g++ -std=c++11 -c -fPIC \
290
- -I../../../../include \
291
- -I../../../../fp16/include \
292
- -I../../../../simsimd/include \
293
- -I${JAVA_HOME}/include -I${JAVA_HOME}/include/darwin cloud_unum_usearch_Index.cpp -o cloud_unum_usearch_Index.o
294
- g++ -dynamiclib -o libusearch.dylib cloud_unum_usearch_Index.o -lc
295
-
296
- # Run linking to that directory
297
- cd ../../../..
298
- cp cloud/unum/usearch/libusearch.* .
299
- java -cp . -Djava.library.path="$(pwd)" cloud.unum.usearch.Index
300
- ```
301
-
302
- ## C#
303
-
304
- Setup the .NET environment:
305
-
306
- ```sh
307
- dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
308
- ```
309
-
310
- USearch provides CSharp bindings, that depend on the C library that must be installed beforehand.
311
- So one should first compile the C library, link it with CSharp, and only then run tests.
312
-
313
- ```sh
314
- cmake -B ./build_artifacts -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1
315
- cmake --build ./build_artifacts --config Release -j
316
- ```
317
-
318
- Then, on Windows, copy the library to the CSharp project and run the tests:
319
-
320
- ```sh
321
- mkdir -p ".\csharp\lib\runtimes\win-x64\native"
322
- cp ".\build_artifacts\libusearch_c.dll" ".\csharp\lib\runtimes\win-x64\native"
323
- cd csharp
324
- dotnet test -c Debug --logger "console;verbosity=detailed"
325
- dotnet test -c Release
326
- ```
327
-
328
- ## Wolfram
329
-
330
- ```sh
331
- brew install --cask wolfram-engine
332
- ```
333
-
334
- ## Docker
335
-
336
- ```sh
337
- docker build -t unum/usearch . && docker run unum/usearch
338
- ```
339
-
340
- For multi-architecture builds and publications:
341
-
342
- ```sh
343
- version=$(cat VERSION)
344
- docker buildx create --use &&
345
- docker login &&
346
- docker buildx build \
347
- --platform "linux/amd64,linux/arm64" \
348
- --build-arg version=$version \
349
- --file Dockerfile \
350
- --tag unum/usearch:$version \
351
- --tag unum/usearch:latest \
352
- --push .
353
- ```
354
-
355
- ## Working on Sub-Modules
356
-
357
- Extending metrics in SimSIMD:
358
-
359
- ```sh
360
- git push --set-upstream https://github.com/ashvardanian/simsimd.git HEAD:main
361
- ```
package/Cargo.toml DELETED
@@ -1,19 +0,0 @@
1
- [package]
2
- name = "usearch"
3
- version = "2.9.2"
4
- authors = ["Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>"]
5
- description = "Smaller & Faster Single-File Vector Search Engine from Unum"
6
- edition = "2021"
7
- license = "Apache-2.0"
8
- publish = true
9
- repository = "https://github.com/unum-cloud/usearch"
10
-
11
- [lib]
12
- name = "usearch"
13
- path = "rust/lib.rs"
14
-
15
- [dependencies]
16
- cxx = "1.0"
17
-
18
- [build-dependencies]
19
- cxx-build = "1.0"
package/Dockerfile DELETED
@@ -1,16 +0,0 @@
1
- # syntax=docker/dockerfile:1
2
-
3
- FROM ubuntu:23.04
4
- ENV DEBIAN_FRONTEND=noninteractive
5
-
6
- RUN apt-get update && \
7
- apt-get install -y --no-install-recommends python3.11 python3-pip && \
8
- apt-get clean && \
9
- rm -rf /var/lib/apt/lists/*
10
- RUN pip3 install --no-cache-dir --break-system-packages ucall usearch
11
-
12
- WORKDIR /usearch
13
- COPY python/usearch/server.py server.py
14
-
15
- ENTRYPOINT ["python3", "./server.py"]
16
- EXPOSE 8545
package/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.9.2
package/assets/unum.png DELETED
Binary file
Binary file
Binary file
package/binding.gyp DELETED
@@ -1,87 +0,0 @@
1
- {
2
- "targets": [
3
- {
4
- "target_name": "usearch",
5
- "sources": ["javascript/lib.cpp"],
6
- "cflags": [
7
- "-fexceptions",
8
- "-Wno-unknown-pragmas",
9
- "-Wno-maybe-uninitialized",
10
- ],
11
- "cflags_cc": [
12
- "-fexceptions",
13
- "-Wno-unknown-pragmas",
14
- "-Wno-maybe-uninitialized",
15
- "-std=c++17",
16
- ],
17
- "include_dirs": [
18
- "<!@(node -p \"require('node-addon-api').include\")",
19
- "include",
20
- "fp16/include",
21
- "simsimd/include",
22
- ],
23
- "dependencies": ["<!(node -p \"require('node-addon-api').gyp\")"],
24
- "xcode_settings": {
25
- "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
26
- "CLANG_CXX_LIBRARY": "libc++",
27
- "MACOSX_DEPLOYMENT_TARGET": "10.15",
28
- },
29
- "msvs_settings": {
30
- "VCCLCompilerTool": {
31
- "ExceptionHandling": 1,
32
- "AdditionalOptions": ["-std:c++17"],
33
- }
34
- },
35
- "conditions": [
36
- [
37
- 'OS=="linux"',
38
- {
39
- "cflags_cc": [
40
- '<!(if [ "$USEARCH_USE_OPENMP" = "1" ]; then echo \'-fopenmp\'; fi)',
41
- ],
42
- "ldflags": [
43
- '<!(if [ "$USEARCH_USE_OPENMP" = "1" ]; then echo \'-lgomp\'; fi)'
44
- ],
45
- "defines": [
46
- "USEARCH_USE_OPENMP=<!(echo ${USEARCH_USE_OPENMP:-0})",
47
- "USEARCH_USE_SIMSIMD=<!(echo ${USEARCH_USE_SIMSIMD:-1})",
48
- "USEARCH_USE_FP16LIB=<!(echo ${USEARCH_USE_FP16LIB:-1})",
49
- "SIMSIMD_TARGET_X86_AVX512=<!(echo ${SIMSIMD_TARGET_X86_AVX512:-1})",
50
- "SIMSIMD_TARGET_ARM_SVE=<!(echo ${SIMSIMD_TARGET_ARM_SVE:-1})",
51
- "SIMSIMD_TARGET_X86_AVX2=<!(echo ${SIMSIMD_TARGET_X86_AVX2:-1})",
52
- "SIMSIMD_TARGET_ARM_NEON=<!(echo ${SIMSIMD_TARGET_ARM_NEON:-1})",
53
- ],
54
- },
55
- ],
56
- [
57
- 'OS=="mac"',
58
- {
59
- "defines": [
60
- "USEARCH_USE_OPENMP=<!(echo ${USEARCH_USE_OPENMP:-0})",
61
- "USEARCH_USE_SIMSIMD=<!(echo ${USEARCH_USE_SIMSIMD:-0})",
62
- "USEARCH_USE_FP16LIB=<!(echo ${USEARCH_USE_FP16LIB:-1})",
63
- "SIMSIMD_TARGET_X86_AVX512=<!(echo ${SIMSIMD_TARGET_X86_AVX512:-0})",
64
- "SIMSIMD_TARGET_ARM_SVE=<!(echo ${SIMSIMD_TARGET_ARM_SVE:-0})",
65
- "SIMSIMD_TARGET_X86_AVX2=<!(echo ${SIMSIMD_TARGET_X86_AVX2:-1})",
66
- "SIMSIMD_TARGET_ARM_NEON=<!(echo ${SIMSIMD_TARGET_ARM_NEON:-1})",
67
- ],
68
- },
69
- ],
70
- [
71
- 'OS=="win"',
72
- {
73
- "defines": [
74
- "USEARCH_USE_OPENMP=0",
75
- "USEARCH_USE_SIMSIMD=0",
76
- "USEARCH_USE_FP16LIB=1",
77
- "SIMSIMD_TARGET_X86_AVX512=0",
78
- "SIMSIMD_TARGET_ARM_SVE=0",
79
- "SIMSIMD_TARGET_X86_AVX2=0",
80
- "SIMSIMD_TARGET_ARM_NEON=0",
81
- ],
82
- },
83
- ],
84
- ],
85
- }
86
- ]
87
- }
package/build.gradle DELETED
@@ -1,204 +0,0 @@
1
- import org.gradle.internal.jvm.Jvm
2
-
3
- plugins {
4
- id 'java-library'
5
- id 'cpp'
6
- id 'maven-publish'
7
- id 'signing'
8
- }
9
-
10
- group "cloud.unum"
11
- version = file("VERSION").text.trim()
12
-
13
- sourceCompatibility = 1.8
14
- targetCompatibility = 1.8
15
-
16
- repositories {
17
- mavenCentral()
18
- }
19
-
20
- sourceSets {
21
- main {
22
- java {
23
- srcDir "java/"
24
- exclude "test/"
25
- }
26
- // Ensure native libraries are included in the main source set
27
- resources {
28
- srcDirs "$buildDir/libs"
29
- include "usearch/**"
30
- }
31
- }
32
- test {
33
- java {
34
- srcDir "java/test"
35
- }
36
- }
37
- }
38
-
39
- task sourcesJar(type: Jar, dependsOn: classes) {
40
- archiveClassifier.set('sources')
41
- from sourceSets.main.allSource
42
- }
43
-
44
- task javadocJar(type: Jar, dependsOn: javadoc) {
45
- archiveClassifier.set('javadoc')
46
- from javadoc.destinationDir
47
- }
48
-
49
- dependencies {
50
- testImplementation('junit:junit:4.13.2')
51
- }
52
-
53
- model {
54
-
55
- components {
56
- usearch(NativeLibrarySpec) {
57
- sources {
58
- cpp {
59
- source {
60
- srcDirs "java/cloud/unum/usearch"
61
- include "**/*.cpp"
62
- }
63
- exportedHeaders {
64
- srcDirs "include", "fp16/include", "simsimd/include", "${Jvm.current().javaHome}/include"
65
- }
66
- }
67
- }
68
- binaries.withType(StaticLibraryBinarySpec) {
69
- buildable = false
70
- }
71
- binaries.withType(SharedLibraryBinarySpec) {
72
- if (targetPlatform.operatingSystem.linux) {
73
- cppCompiler.args '-I', "${Jvm.current().javaHome}/include/linux"
74
- cppCompiler.args '-D_FILE_OFFSET_BITS=64'
75
- cppCompiler.args '-std=c++11'
76
- } else if (targetPlatform.operatingSystem.macOsX) {
77
- cppCompiler.args '-I', "${Jvm.current().javaHome}/include/darwin"
78
- cppCompiler.args '-D_FILE_OFFSET_BITS=64'
79
- cppCompiler.args '-std=c++11'
80
- } else if (targetPlatform.operatingSystem.windows){
81
- cppCompiler.args "-I${Jvm.current().javaHome}/include/win32"
82
- cppCompiler.args '/std:c++11'
83
- }
84
- }
85
- }
86
- }
87
-
88
- toolChains {
89
- gcc(Gcc) {
90
- target("linux_aarch64") {
91
- cppCompiler.withArguments { args ->
92
- args << "-march=armv8-a"
93
- }
94
- }
95
- }
96
- }
97
- }
98
-
99
- test {
100
- forkEvery 1
101
-
102
- dependsOn jar
103
-
104
- // Rearrange test classpath, add compiled JAR instead of main classes
105
- classpath = project.sourceSets.test.output + configurations.testRuntimeClasspath + files(jar.archiveFile)
106
-
107
- // Enable detailed test logging
108
- testLogging {
109
- // Ensure that we get output from all tests, not just failing ones
110
- showStandardStreams = true
111
- exceptionFormat = 'full' // Can be 'short', 'full', or 'summary'
112
-
113
- // More detailed test result logging
114
- events "passed", "skipped", "failed"
115
- }
116
- }
117
-
118
- jar {
119
- dependsOn("usearchSharedLibrary")
120
- from("$buildDir/libs/usearch/shared") {
121
- include "libusearch.so", "libusearch.dylib", "libusearch.dll"
122
- into "usearch"
123
- }
124
- from sourceSets.main.output
125
- }
126
-
127
- signing {
128
- def signingKey = findProperty("signingKey")
129
- def signingPassword = findProperty("signingPassword")
130
- useInMemoryPgpKeys(signingKey, signingPassword)
131
- sign publishing.publications
132
- }
133
-
134
- publishing {
135
- publications {
136
- library(MavenPublication) {
137
- from components.java
138
-
139
- artifact sourcesJar
140
- artifact javadocJar
141
-
142
- signing {
143
- sign publishing.publications.library
144
- }
145
-
146
- pom {
147
- name = "USearch"
148
- description = "Smaller & Faster Single-File Vector Search Engine from Unum"
149
- url = "https://github.com/unum-cloud/usearch"
150
-
151
- licenses {
152
- license {
153
- name = 'The Apache License, Version 2.0'
154
- url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
155
- }
156
- }
157
-
158
- scm {
159
- connection = 'scm:git:git://github.com/unum-cloud/usearch.git'
160
- developerConnection = 'scm:git:ssh://github.com/unum-cloud/usearch.git'
161
- url = 'https://github.com/unum-cloud/usearch'
162
- }
163
-
164
- developers {
165
- developer {
166
- id = 'ashvardanian'
167
- name = 'Ash Vardanian'
168
- email = 'ash.vardanian@unum.cloud'
169
- }
170
- }
171
- }
172
- }
173
- }
174
-
175
-
176
- // Publishing to GitHub is much easier ;)
177
- repositories {
178
- maven {
179
- name = "OSSRH"
180
- url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
181
- credentials {
182
- username = System.getenv("MAVEN_USERNAME")
183
- password = System.getenv("MAVEN_PASSWORD")
184
- }
185
- }
186
- }
187
-
188
- repositories {
189
- maven {
190
- name = "GitHubPackages"
191
- url = "https://maven.pkg.github.com/unum-cloud/usearch"
192
- credentials {
193
- username = System.getenv("GITHUB_ACTOR")
194
- password = System.getenv("GITHUB_TOKEN")
195
- }
196
- }
197
- }
198
- }
199
-
200
- // Ensure that the native library is built before the Java code
201
- compileJava.dependsOn tasks.withType(SharedLibraryBinarySpec)
202
- tasks.named("processResources").configure {
203
- dependsOn tasks.named("linkUsearchSharedLibrary")
204
- }