Skip to content

Commit 4c055d3

Browse files
authored
Merge pull request #480 from unum-cloud/main-dev
2 parents b3da759 + 04eb837 commit 4c055d3

34 files changed

+706
-340
lines changed

.github/workflows/prerelease.yml

+40-35
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ jobs:
5252
dry-run: "true"
5353

5454
test_ubuntu_gcc:
55-
name: Ubuntu (GCC 12)
56-
runs-on: ubuntu-22.04
55+
name: Ubuntu (GCC 14)
56+
runs-on: ubuntu-24.04
5757
env:
58-
CC: gcc-12
59-
CXX: g++-12
58+
CC: gcc
59+
CXX: g++
6060

6161
steps:
6262
- uses: actions/checkout@v4
@@ -67,12 +67,12 @@ jobs:
6767
run: |
6868
sudo apt update
6969
sudo apt install -y cmake build-essential libjemalloc-dev libomp-dev gcc-12 g++-12
70-
cmake -B build_artifacts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_SQLITE=1 -DUSEARCH_USE_OPENMP=1 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1
70+
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo -D USEARCH_BUILD_TEST_CPP=1 -D USEARCH_BUILD_TEST_C=1 -D USEARCH_BUILD_LIB_C=1 -D USEARCH_BUILD_SQLITE=1 -D USEARCH_USE_OPENMP=1 -D USEARCH_USE_SIMSIMD=1 -D USEARCH_USE_JEMALLOC=1
7171
cmake --build build_artifacts --config RelWithDebInfo
7272
- name: Test C++
73-
run: ./build_artifacts/test_cpp
73+
run: build_artifacts/test_cpp
7474
- name: Test C
75-
run: ./build_artifacts/test_c
75+
run: build_artifacts/test_c
7676

7777
# Python
7878
- name: Set up Python ${{ env.PYTHON_VERSION }}
@@ -141,11 +141,11 @@ jobs:
141141
working-directory: ${{ github.workspace }}/golang/
142142

143143
test_ubuntu_clang:
144-
name: Ubuntu (Clang 16)
145-
runs-on: ubuntu-22.04
144+
name: Ubuntu (Clang 18)
145+
runs-on: ubuntu-24.04
146146
env:
147-
CC: clang-16
148-
CXX: clang++-16
147+
CC: clang
148+
CXX: clang++
149149

150150
steps:
151151
- uses: actions/checkout@v4
@@ -156,16 +156,13 @@ jobs:
156156
- name: Build C/C++
157157
run: |
158158
sudo apt update
159-
sudo apt install -y cmake build-essential libjemalloc-dev
160-
wget https://apt.llvm.org/llvm.sh
161-
chmod +x llvm.sh
162-
sudo ./llvm.sh 16
163-
cmake -B build_artifacts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_SQLITE=1 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=1
159+
sudo apt install -y cmake build-essential libjemalloc-dev clang
160+
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo -D USEARCH_BUILD_TEST_CPP=1 -D USEARCH_BUILD_TEST_C=1 -D USEARCH_BUILD_LIB_C=1 -D USEARCH_BUILD_SQLITE=1 -D USEARCH_USE_OPENMP=0 -D USEARCH_USE_SIMSIMD=1 -D USEARCH_USE_JEMALLOC=1
164161
cmake --build build_artifacts --config RelWithDebInfo
165162
- name: Test C++
166-
run: ./build_artifacts/test_cpp
163+
run: build_artifacts/test_cpp
167164
- name: Test C
168-
run: ./build_artifacts/test_c
165+
run: build_artifacts/test_c
169166

170167
# JavaScript
171168
- name: Set up Node.js
@@ -190,6 +187,9 @@ jobs:
190187
pip install pytest pytest-repeat numpy numba cppyy
191188
pip install --upgrade git+https://github.com/Maratyszcza/PeachPy
192189
python -m pip install .
190+
env:
191+
CXX: clang++
192+
CC: clang++ # Override the default compiler
193193
- name: Test Python
194194
run: pytest
195195

@@ -208,7 +208,7 @@ jobs:
208208

209209
test_macos:
210210
name: MacOS
211-
runs-on: macos-12
211+
runs-on: macos-14
212212

213213
steps:
214214
- uses: actions/checkout@v4
@@ -219,12 +219,12 @@ jobs:
219219
run: |
220220
brew update
221221
brew install cmake
222-
cmake -B build_artifacts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_SQLITE=1
222+
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo -D USEARCH_BUILD_TEST_CPP=1 -D USEARCH_BUILD_TEST_C=1 -D USEARCH_BUILD_LIB_C=1 -D USEARCH_BUILD_SQLITE=1
223223
cmake --build build_artifacts --config RelWithDebInfo
224224
- name: Test C++
225-
run: ./build_artifacts/test_cpp
225+
run: build_artifacts/test_cpp
226226
- name: Test C
227-
run: ./build_artifacts/test_c
227+
run: build_artifacts/test_c
228228

229229
# JavaScript
230230
- name: Set up Node.js
@@ -248,6 +248,9 @@ jobs:
248248
python -m pip install --upgrade pip
249249
pip install pytest pytest-repeat numpy
250250
python -m pip install .
251+
env:
252+
CXX: clang++
253+
CC: clang++ # Override the default compiler
251254
- name: Test Python
252255
run: pytest
253256

@@ -264,11 +267,13 @@ jobs:
264267
dotnet-version: ${{ env.DOTNET_VERSION }}
265268
- name: Test .NET
266269
run: |
267-
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
268-
cp "${{ github.workspace }}/build_artifacts/libusearch_c.dylib" "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
270+
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/osx-arm64/native"
271+
cp "${{ github.workspace }}/build_artifacts/libusearch_c.dylib" "${{ github.workspace }}/csharp/lib/runtimes/osx-arm64/native"
269272
dotnet test -c Debug --logger "console;verbosity=detailed" --filter "FullyQualifiedName!=Cloud.Unum.USearch.Tests.UsearchIndexTests.PersistAndRestore"
270273
shell: bash
271274
working-directory: ${{ github.workspace }}/csharp
275+
env:
276+
DYLD_PRINT_LIBRARIES: 1
272277

273278
test_windows:
274279
name: Windows
@@ -281,7 +286,7 @@ jobs:
281286
- name: Build C/C++
282287
run: |
283288
choco install cmake
284-
cmake -B build_artifacts -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSEARCH_BUILD_TEST_CPP=1 -DUSEARCH_BUILD_TEST_C=1 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_BUILD_SQLITE=0
289+
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo -D USEARCH_BUILD_TEST_CPP=1 -D USEARCH_BUILD_TEST_C=1 -D USEARCH_BUILD_LIB_C=1 -D USEARCH_BUILD_SQLITE=0
285290
cmake --build build_artifacts --config RelWithDebInfo
286291
- name: Test C++
287292
run: .\build_artifacts\test_cpp.exe
@@ -398,16 +403,16 @@ jobs:
398403
- name: Build C/C++
399404
run: |
400405
cmake -B build_artifacts \
401-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
402-
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
403-
-DCMAKE_C_COMPILER_TARGET=${{ matrix.target }} \
404-
-DCMAKE_CXX_COMPILER_TARGET=${{ matrix.target }} \
405-
-DCMAKE_SYSTEM_NAME=Linux \
406-
-DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} \
407-
-DUSEARCH_BUILD_LIB_C=1 \
408-
-DUSEARCH_BUILD_SQLITE=1 \
409-
-DUSEARCH_BUILD_TEST_CPP=0 \
410-
-DUSEARCH_BUILD_BENCH_CPP=0
406+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
407+
-D CMAKE_EXPORT_COMPILE_COMMANDS=1 \
408+
-D CMAKE_C_COMPILER_TARGET=${{ matrix.target }} \
409+
-D CMAKE_CXX_COMPILER_TARGET=${{ matrix.target }} \
410+
-D CMAKE_SYSTEM_NAME=Linux \
411+
-D CMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} \
412+
-D USEARCH_BUILD_LIB_C=1 \
413+
-D USEARCH_BUILD_SQLITE=1 \
414+
-D USEARCH_BUILD_TEST_CPP=0 \
415+
-D USEARCH_BUILD_BENCH_CPP=0
411416
412417
cmake --build build_artifacts --config RelWithDebInfo
413418

.github/workflows/release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ jobs:
268268
strategy:
269269
fail-fast: false
270270
matrix:
271-
os: [ubuntu-22.04, macOS-11, windows-2022]
271+
os: [ubuntu-22.04, macOS-12, windows-2022]
272272
steps:
273273
- name: Check out refreshed version
274274
uses: actions/checkout@v4
@@ -318,7 +318,7 @@ jobs:
318318
zip -r usearch_wasm_macos_"$arch"_${{ steps.set_version.outputs.version }}.zip libusearch_c.dylib
319319
mv usearch_wasm_macos_"$arch"_${{ steps.set_version.outputs.version }}.zip ../ && rm -rf libusearch_c.dylib
320320
done
321-
if: matrix.os == 'macOS-11'
321+
if: matrix.os == 'macOS-12'
322322

323323
- name: Build library on Windows
324324
run: |
@@ -710,7 +710,7 @@ jobs:
710710
strategy:
711711
fail-fast: false
712712
matrix:
713-
os: [ubuntu-22.04, macos-12, windows-2022]
713+
os: [ubuntu-22.04, macos-14, windows-2022]
714714
runs-on: ${{ matrix.os }}
715715
defaults:
716716
run:
@@ -743,8 +743,8 @@ jobs:
743743
brew install cmake
744744
cmake -B build_artifacts -DCMAKE_BUILD_TYPE=Release -DUSEARCH_BUILD_TEST_CPP=0 -DUSEARCH_BUILD_TEST_C=0 -DUSEARCH_BUILD_LIB_C=1 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=1 -DUSEARCH_USE_JEMALLOC=0
745745
cmake --build build_artifacts --config Release
746-
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
747-
cp "${{ github.workspace }}/build_artifacts/libusearch_c.dylib" "${{ github.workspace }}/csharp/lib/runtimes/osx-x64/native"
746+
mkdir -p "${{ github.workspace }}/csharp/lib/runtimes/osx-arm64/native"
747+
cp "${{ github.workspace }}/build_artifacts/libusearch_c.dylib" "${{ github.workspace }}/csharp/lib/runtimes/osx-arm64/native"
748748
749749
- name: Build C library for Windows
750750
if: matrix.os == 'windows-2022'

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
"astype",
131131
"autovec",
132132
"Availible",
133+
"BFLOAT",
133134
"bidict",
134135
"BLAS",
135136
"Cdecl",
@@ -167,7 +168,9 @@
167168
"MSVC",
168169
"Napi",
169170
"ndarray",
171+
"NDCG",
170172
"ndim",
173+
"nlevels",
171174
"Numba",
172175
"numpy",
173176
"objc",

CMakeLists.txt

+71
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,63 @@ set(USEARCH_CMAKE_PROJECT_CONFIG_FILE "${USEARCH_CMAKE_CONFIG_DIR}/${PROJECT_NAM
5656
set(USEARCH_CMAKE_PROJECT_TARGETS_FILE "${USEARCH_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Targets.cmake")
5757
set(USEARCH_PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/pkgconfig")
5858

59+
include(CheckCSourceCompiles)
60+
# Check for `__fp16` support
61+
check_c_source_compiles(
62+
[=[
63+
int
64+
main(int argc, char *argv)
65+
{
66+
__fp16 a = 1.0;
67+
__fp16 b = a + a;
68+
return 0;
69+
}
70+
]=]
71+
USEARCH_CAN_COMPILE_FP16
72+
)
73+
74+
# Check for `_Float16` support
75+
check_c_source_compiles(
76+
[=[
77+
int
78+
main(int argc, char *argv)
79+
{
80+
_Float16 a = 1.0;
81+
_Float16 b = a + a;
82+
return 0;
83+
}
84+
]=]
85+
USEARCH_CAN_COMPILE_FLOAT16
86+
)
87+
88+
# Check for `__bf16` support
89+
check_c_source_compiles(
90+
[=[
91+
int
92+
main(int argc, char *argv)
93+
{
94+
__bf16 a = 1.0;
95+
__bf16 b = a + a;
96+
return 0;
97+
}
98+
]=]
99+
USEARCH_CAN_COMPILE_BF16
100+
)
101+
102+
# Check for `_Bfloat16` support
103+
check_c_source_compiles(
104+
[=[
105+
int
106+
main(int argc, char *argv)
107+
{
108+
_Bfloat16 a = 1.0;
109+
_Bfloat16 b = a + a;
110+
return 0;
111+
}
112+
]=]
113+
USEARCH_CAN_COMPILE_BFLOAT16
114+
)
115+
59116
# Define our header-only library
60117
add_library(${USEARCH_TARGET_NAME} INTERFACE)
61118
add_library(${PROJECT_NAME}::${USEARCH_TARGET_NAME} ALIAS ${USEARCH_TARGET_NAME})
@@ -74,6 +131,20 @@ target_compile_definitions(${USEARCH_TARGET_NAME} INTERFACE "USEARCH_USE_OPENMP=
74131
target_compile_definitions(${USEARCH_TARGET_NAME} INTERFACE "USEARCH_USE_FP16LIB=$<BOOL:${USEARCH_USE_FP16LIB}>")
75132
target_compile_definitions(${USEARCH_TARGET_NAME} INTERFACE "USEARCH_USE_SIMSIMD=$<BOOL:${USEARCH_USE_SIMSIMD}>")
76133

134+
# Define which types can be compiled
135+
target_compile_definitions(
136+
${USEARCH_TARGET_NAME} INTERFACE "USEARCH_CAN_COMPILE_FP16=$<BOOL:${USEARCH_CAN_COMPILE_FP16}>"
137+
)
138+
target_compile_definitions(
139+
${USEARCH_TARGET_NAME} INTERFACE "USEARCH_CAN_COMPILE_FLOAT16=$<BOOL:${USEARCH_CAN_COMPILE_FLOAT16}>"
140+
)
141+
target_compile_definitions(
142+
${USEARCH_TARGET_NAME} INTERFACE "USEARCH_CAN_COMPILE_BF16=$<BOOL:${USEARCH_CAN_COMPILE_BF16}>"
143+
)
144+
target_compile_definitions(
145+
${USEARCH_TARGET_NAME} INTERFACE "USEARCH_CAN_COMPILE_BFLOAT16=$<BOOL:${USEARCH_CAN_COMPILE_BFLOAT16}>"
146+
)
147+
77148
target_include_directories(
78149
${USEARCH_TARGET_NAME} ${USEARCH_SYSTEM_INCLUDE} INTERFACE $<BUILD_INTERFACE:${USEARCH_INCLUDE_BUILD_DIR}>
79150
$<INSTALL_INTERFACE:include>

0 commit comments

Comments
 (0)