Skip to content

Commit 7007bb5

Browse files
committed
EXAMPLES/UCS_ANN_SEARCH: new example to be also used for benchmarking
1 parent e57702e commit 7007bb5

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

examples/Makefile.am

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
#
77

88
examplesdir = $(pkgdatadir)/examples
9-
dist_examples_DATA = \
9+
dist_examples_DATA = \
1010
hello_world_util.h \
1111
ucp_hello_world.c \
1212
uct_hello_world.c \
1313
ucp_client_server.c \
14+
ucs_ann_search.c \
1415
ucp_util.h
1516

1617
if HAVE_CUDA
@@ -43,6 +44,13 @@ noinst_PROGRAMS = \
4344
uct_hello_world \
4445
ucp_client_server
4546

47+
lib_LTLIBRARIES = libucs_ann_search.la
48+
49+
libucs_ann_search_la_SOURCES = ucs_ann_search.c
50+
libucs_ann_search_la_LIBADD = $(top_builddir)/src/ucs/libucs.la
51+
libucs_ann_search_la_LDFLAGS = -ldl -version-info $(SOVERSION)
52+
libucs_ann_search_la_CPPFLAGS = $(BASE_CPPFLAGS) -g
53+
4654
ucp_hello_world_SOURCES = ucp_hello_world.c
4755
ucp_hello_world_CFLAGS = $(BASE_CFLAGS) $(EXAMPLE_CUDA_CFLAGS)
4856
ucp_hello_world_CPPFLAGS = $(BASE_CPPFLAGS) $(EXAMPLE_CUDA_CPPFLAGS)

examples/ucs_ann_search.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* See file LICENSE for terms.
3+
*/
4+
5+
#include <ucs/datastruct/ndim_knn.h>
6+
7+
#define EXPORTED __attribute__((visibility("protected")))
8+
#define DIM_LIST 1, 2, 3, 16, 20, 25, 50, 96, 100, 128, 200, 256, 784, 800, 960
9+
10+
#define WNN_BY_DIM(_K, _ndim) \
11+
NDIM_WNN_INIT2(char_to_unsigned_##_ndim##_dim_k##_K, _K, _ndim, EXPORTED, \
12+
char, unsigned, khint32_t, kh_int_hash_func, \
13+
kh_int_hash_equal, kh_int_hash_func, kh_int_hash_equal) \
14+
NDIM_WNN_INIT2(int32_to_int32_##_ndim##_dim_k##_K, _K, _ndim, EXPORTED, \
15+
khint32_t, unsigned, khint32_t, kh_int_hash_func, \
16+
kh_int_hash_equal, kh_int_hash_func, kh_int_hash_equal) \
17+
NDIM_WNN_INIT2(int64_to_int64_##_ndim##_dim_k##_K, _K, _ndim, EXPORTED, \
18+
khint64_t, khint64_t, khint64_t, kh_int_hash_func, \
19+
kh_int_hash_equal, kh_int64_hash_func, kh_int64_hash_equal) \
20+
NDIM_WNN_INIT2(float_to_unsigned_##_ndim##_dim_k##_K, _K, _ndim, EXPORTED, \
21+
float, unsigned, int, kh_int_hash_func, kh_int_hash_equal, \
22+
kh_int_hash_func, kh_int_hash_equal) \
23+
NDIM_WNN_INIT2(float_to_ptr_##_ndim##_dim_k##_K, _K, _ndim, EXPORTED, \
24+
float, uintptr_t, float, kh_int_hash_func, kh_int_hash_equal, \
25+
kh_int64_hash_func, kh_int64_hash_equal) \
26+
NDIM_WNN_INIT2(cstr_to_ptr_##_ndim##_dim_k##_K, _K, _ndim, EXPORTED, \
27+
kh_cstr_t, unsigned, float, kh_str_hash_func, \
28+
kh_str_hash_equal, kh_int_hash_func, kh_int_hash_equal)
29+
30+
UCS_PP_FOREACH(WNN_BY_DIM, 1, DIM_LIST)
31+
UCS_PP_FOREACH(WNN_BY_DIM, 10, DIM_LIST)

0 commit comments

Comments
 (0)