Skip to content

Commit a519100

Browse files
committed
revert back to 0.12.4
1 parent 7487971 commit a519100

File tree

7 files changed

+72
-90
lines changed

7 files changed

+72
-90
lines changed

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ branches:
66
only:
77
- master
88

9-
skip_non_tags: false
9+
skip_non_tags: true
1010

1111
image: Visual Studio 2022
1212

@@ -61,7 +61,7 @@ build_script:
6161
6262
cd windows-x86_64
6363
64-
call ..\lein.bat run
64+
call ..\lein.bat deploy clojars
6565
6666
6767
on_finish:

script/build.bat

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ cmake -G "Visual Studio 17 2022" ^
1111
-DCLOSE_WARNING=on ^
1212
-DBUILD_TEST=off ^
1313
-DCMAKE_INSTALL_PREFIX=%CPATH% ^
14-
-DCMAKE_BUILD_TYPE=Debug ^
1514
-B build_dtlv
1615

1716
cmake --build build_dtlv --config Release --target install
@@ -28,15 +27,11 @@ cd %CPATH%
2827

2928
dir %CPATH%
3029

31-
dumpbin /SYMBOLS libusearch_static_c.lib
32-
3330
cd java
3431

35-
java -Djavacpp.debug=true -Djavacpp.deleteJniFiles=false -jar "%USERPROFILE%\.m2\repository\org\bytedeco\javacpp\1.5.11\javacpp-1.5.11.jar" -nodelete ^
32+
java -jar "%USERPROFILE%\.m2\repository\org\bytedeco\javacpp\1.5.11\javacpp-1.5.11.jar" ^
3633
datalevin/dtlvnative/DTLV.java
3734

38-
type C:\projects\dtlvnative\src\java\datalevin\dtlvnative\jniDTLV.cpp
39-
4035
dir datalevin\dtlvnative\windows-x86_64
4136

4237
dumpbin /linkermember:2 datalevin\dtlvnative\windows-x86_64\jniDTLV.dll

src/CMakeLists.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,16 @@ set(USEARCH_BUILD_LIB_C ON CACHE BOOL "" FORCE)
6161
set(USEARCH_BUILD_TEST_C ON CACHE BOOL "" FORCE)
6262
set(USEARCH_BUILD_TEST_CPP ON CACHE BOOL "" FORCE)
6363

64-
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
65-
66-
foreach(config DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
67-
string(TOUPPER ${config} config_upper)
68-
set(CMAKE_C_FLAGS_${config_upper} "${CMAKE_C_FLAGS_${config_upper}} /MD")
69-
set(CMAKE_CXX_FLAGS_${config_upper} "${CMAKE_CXX_FLAGS_${config_upper}} /MD")
70-
endforeach()
71-
72-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd")
73-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
74-
7564
add_subdirectory(${PROJECT_SOURCE_DIR}/usearch usearch_static_c_build)
7665

7766
set_target_properties(usearch_static_c PROPERTIES
7867
OUTPUT_NAME usearch_static_c
7968
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}
8069
)
8170

71+
target_link_options(dtlv PRIVATE "/WHOLEARCHIVE:usearch_static_c")
72+
target_link_libraries(dtlv PRIVATE usearch_static_c)
73+
8274
install(TARGETS usearch_static_c
8375
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}
8476
)

src/java/datalevin/dtlvnative/DTLV.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,6 @@ protected usearch_metric_t() {
23512351
usearch_scalar_b1_k = 5;
23522352

23532353
@Name("usearch_init_options_t")
2354-
@NoOffset
23552354
public static class usearch_init_options_t extends Pointer {
23562355
static {
23572356
Loader.load();

src/java/datalevin/dtlvnative/DTLVConfig.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
),
1717
@Platform( // Windows
1818
value = "windows",
19-
compiler = {"-D_CRT_SECURE_NO_WARNINGS"},
20-
link = { "lmdb", "vcomp", "Advapi32", "libusearch_static_c", "dtlv" }
19+
link = { "lmdb", "libusearch_static_c", "dtlv", "Advapi32" }
2120
),
2221
@Platform( // Unix-like
2322
value = { "linux", "macosx" },
@@ -30,7 +29,5 @@
3029
public class DTLVConfig {
3130
public void map(InfoMap infoMap) {
3231
infoMap.put(new Info("USEARCH_EXPORT").cppTypes().annotations());
33-
infoMap.put(new Info("usearch_init_options_t").pointerTypes("usearch_init_options_t"));
34-
3532
}
3633
}

src/java/datalevin/dtlvnative/Test.java

Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,15 @@ static float[][] randomVectors(final int n, final int dimensions) {
167167
}
168168

169169
static DTLV.usearch_init_options_t createOpts(final long dimensions) {
170+
DTLV.usearch_metric_t nullMetric = new DTLV.usearch_metric_t();
171+
nullMetric.zero();
172+
nullMetric.setNull();
170173

171174
DTLV.usearch_init_options_t opts = new DTLV.usearch_init_options_t();
172175
opts.zero();
173176

174177
opts.metric_kind(DTLV.usearch_metric_ip_k)
175-
.metric((usearch_metric_t) null)
178+
.metric((usearch_metric_t) nullMetric)
176179
.quantization(DTLV.usearch_scalar_f32_k)
177180
.dimensions(dimensions)
178181
.connectivity(3)
@@ -202,87 +205,83 @@ static void expectNoError(PointerPointer<BytePointer> error, String message) {
202205
}
203206

204207
static void testUsearchInit(int collSize, int dimensions) {
205-
try {
206-
DTLV.usearch_init_options_t opts = createOpts(dimensions);
207208

208-
expect(opts.metric_kind() == DTLV.usearch_metric_ip_k, "fail to get metric_kind");
209-
expect(opts.quantization() == DTLV.usearch_scalar_f32_k, "fail to get quantization");
210-
expect(opts.connectivity() == 3, "fail to get connectivity");
211-
expect(opts.dimensions() == dimensions, "fail to get dimensions");
212-
expect(opts.expansion_add() == 40, "fail to get expansion_add");
213-
expect(opts.expansion_search() == 16, "fail to get expansion_search");
214-
expect(opts.multi() == false, "fail to get multi");
209+
DTLV.usearch_init_options_t opts = createOpts(dimensions);
215210

216-
PointerPointer<BytePointer> error = new PointerPointer<BytePointer>(1).put((BytePointer)null);
211+
expect(opts.metric_kind() == DTLV.usearch_metric_ip_k, "fail to get metric_kind");
212+
expect(opts.quantization() == DTLV.usearch_scalar_f32_k, "fail to get quantization");
213+
expect(opts.connectivity() == 3, "fail to get connectivity");
214+
expect(opts.dimensions() == dimensions, "fail to get dimensions");
215+
expect(opts.expansion_add() == 40, "fail to get expansion_add");
216+
expect(opts.expansion_search() == 16, "fail to get expansion_search");
217+
expect(opts.multi() == false, "fail to get multi");
217218

218-
System.out.println("About to call usearch_init");
219-
DTLV.usearch_index_t index = DTLV.usearch_init(opts, error);
220-
expect(index != null, "Failed to init index");
221-
System.out.println("Successfully called init");
219+
PointerPointer<BytePointer> error = new PointerPointer<>(1);
222220

223-
error.put(0, (BytePointer) null);
224-
DTLV.usearch_free(index, error);
225-
expectNoError(error, "Fail to free index");
221+
error.put(0, (BytePointer) null);
222+
DTLV.usearch_index_t index = DTLV.usearch_init(opts, error);
223+
System.out.println("called init");
224+
expect(index != null, "Failed to init index");
226225

227-
error.put(0, (BytePointer) null);
228-
index = DTLV.usearch_init(opts, error);
229-
expect(index != null, "Failed to init index");
226+
error.put(0, (BytePointer) null);
227+
DTLV.usearch_free(index, error);
228+
expectNoError(error, "Fail to free index");
230229

231-
error.put(0, (BytePointer) null);
232-
long size = DTLV.usearch_size(index, error);
233-
expect(size == 0, "Failed to get index size");
230+
error.put(0, (BytePointer) null);
231+
index = DTLV.usearch_init(opts, error);
232+
expect(index != null, "Failed to init index");
234233

235-
error.put(0, (BytePointer) null);
236-
long capacity = DTLV.usearch_capacity(index, error);
237-
expect(capacity == 0, "Failed to get index capacity");
234+
error.put(0, (BytePointer) null);
235+
long size = DTLV.usearch_size(index, error);
236+
expect(size == 0, "Failed to get index size");
238237

239-
error.put(0, (BytePointer) null);
240-
long dims = DTLV.usearch_dimensions(index, error);
241-
expect(dimensions == dims, "Failed to get index dimensions");
238+
error.put(0, (BytePointer) null);
239+
long capacity = DTLV.usearch_capacity(index, error);
240+
expect(capacity == 0, "Failed to get index capacity");
242241

243-
error.put(0, (BytePointer) null);
244-
long connectivity = DTLV.usearch_connectivity(index, error);
245-
expect(connectivity == opts.connectivity(),
246-
"Failed to get index connectivity");
242+
error.put(0, (BytePointer) null);
243+
long dims = DTLV.usearch_dimensions(index, error);
244+
expect(dimensions == dims, "Failed to get index dimensions");
247245

248-
error.put(0, (BytePointer) null);
249-
DTLV.usearch_reserve(index, collSize, error);
250-
expectNoError(error, "Fail to reserve");
246+
error.put(0, (BytePointer) null);
247+
long connectivity = DTLV.usearch_connectivity(index, error);
248+
expect(connectivity == opts.connectivity(),
249+
"Failed to get index connectivity");
251250

252-
error.put(0, (BytePointer) null);
253-
size = DTLV.usearch_size(index, error);
254-
expect(size == 0, "Failed to get index size");
251+
error.put(0, (BytePointer) null);
252+
DTLV.usearch_reserve(index, collSize, error);
253+
expectNoError(error, "Fail to reserve");
255254

256-
error.put(0, (BytePointer) null);
257-
capacity = DTLV.usearch_capacity(index, error);
258-
expect(capacity >= collSize, "Failed to get index capacity");
255+
error.put(0, (BytePointer) null);
256+
size = DTLV.usearch_size(index, error);
257+
expect(size == 0, "Failed to get index size");
259258

260-
error.put(0, (BytePointer) null);
261-
dims = DTLV.usearch_dimensions(index, error);
262-
expect(dimensions == dims, "Failed to get index dimensions");
259+
error.put(0, (BytePointer) null);
260+
capacity = DTLV.usearch_capacity(index, error);
261+
expect(capacity >= collSize, "Failed to get index capacity");
263262

264-
error.put(0, (BytePointer) null);
265-
connectivity = DTLV.usearch_connectivity(index, error);
266-
expect(connectivity == opts.connectivity(),
267-
"Failed to get index connectivity");
263+
error.put(0, (BytePointer) null);
264+
dims = DTLV.usearch_dimensions(index, error);
265+
expect(dimensions == dims, "Failed to get index dimensions");
268266

269-
error.put(0, (BytePointer) null);
270-
BytePointer hardware = DTLV.usearch_hardware_acceleration(index, error);
271-
expectNoError(error, "Fail to get hardware");
272-
System.out.println("SIMD Hardware ISA Name is: " + hardware.getString());
267+
error.put(0, (BytePointer) null);
268+
connectivity = DTLV.usearch_connectivity(index, error);
269+
expect(connectivity == opts.connectivity(),
270+
"Failed to get index connectivity");
273271

274-
error.put(0, (BytePointer) null);
275-
long memory = DTLV.usearch_memory_usage(index, error);
276-
expect(memory > 0, "Failed to get memory usage");
277-
System.out.println("Memory Usage is: " + memory);
272+
error.put(0, (BytePointer) null);
273+
BytePointer hardware = DTLV.usearch_hardware_acceleration(index, error);
274+
expectNoError(error, "Fail to get hardware");
275+
System.out.println("SIMD Hardware ISA Name is: " + hardware.getString());
278276

279-
error.put(0, (BytePointer) null);
280-
DTLV.usearch_free(index, error);
281-
expectNoError(error, "Fail to free index");
282-
} catch (Exception e) {
283-
System.out.println("Java exception: " + e.getMessage());
284-
e.printStackTrace();
285-
}
277+
error.put(0, (BytePointer) null);
278+
long memory = DTLV.usearch_memory_usage(index, error);
279+
expect(memory > 0, "Failed to get memory usage");
280+
System.out.println("Memory Usage is: " + memory);
281+
282+
error.put(0, (BytePointer) null);
283+
DTLV.usearch_free(index, error);
284+
expectNoError(error, "Fail to free index");
286285

287286
System.out.println("Passed init.");
288287
}

windows-x86_64/project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:java-source-paths ["../src/java"]
1111
:jar-exclusions [#"\.java"]
1212
:javac-options ["-Xlint:unchecked" "-Xlint:-options" "--release" "11"]
13-
:jvm-opts ["-Dorg.bytedeco.javacpp.logger.debug=true" "-Xcheck:jni" "-Dclojure.debug=true"]
13+
:jvm-opts ["-Dorg.bytedeco.javacpp.logger.debug=false" "-Xcheck:jni" "-Dclojure.debug=false"]
1414
:main datalevin.dtlvnative.Test
1515
:deploy-repositories [["clojars" {:url "https://repo.clojars.org"
1616
:username :env/clojars_username

0 commit comments

Comments
 (0)