Search and Clustering wirh exfaiss
Mix.install([
{:ex_faiss, github: "elixir-nx/ex_faiss"},
{:nx, "~> 0.4"},
{:exla, "~> 0.4"}
])
==> ex_faiss
cp -a /Users/rakshan/.cache/ex_faiss/faiss-19f7696deedc93615c3ee0ff4de22284b53e0243/build/faiss cache/lib
clang++ -I/nix/store/3ra4m505v0433vjf8xm2g2wnx8hbahms-erlang-25.1.2/lib/erlang/erts-13.1.2/include -I/Users/rakshan/.cache/ex_faiss/faiss-19f7696deedc93615c3ee0ff4de22284b53e0243 -fPIC -O3 -shared -std=c++14 c_src/ex_faiss.cc c_src/ex_faiss/nif_util.cc c_src/ex_faiss/index.cc \
c_src/ex_faiss/clustering.cc -o cache/libex_faiss.so -Lcache/lib -lfaiss -flat_namespace -undefined suppress
ld: warning: direct access in function 'faiss::Cloner::clone_Index(faiss::Index const*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(clone_index.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMapTemplate' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::Cloner::clone_Index(faiss::Index const*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(clone_index.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMapTemplate' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index(faiss::Index const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMap2Template' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index(faiss::Index const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMap2Template' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index(faiss::Index const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMapTemplate' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index(faiss::Index const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMapTemplate' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index_binary(faiss::IndexBinary const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMap2Template' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index_binary(faiss::IndexBinary const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMap2Template' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index_binary(faiss::IndexBinary const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMapTemplate' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'faiss::write_index_binary(faiss::IndexBinary const*, faiss::IOWriter*)' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(index_write.cpp.o)' to global weak symbol 'typeinfo for faiss::IndexIDMapTemplate' from file '/nix/store/f098amzvk2fgd1wjmb4f6da6kwwjsr7l-faiss-1.7.2/lib/libfaiss.a(MetaIndexes.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
install_name_tool cache/libex_faiss.so -change @rpath/libfaiss.dylib @loader_path/lib/libfaiss.dylib
Compiling 5 files (.ex)
12:39:13.865 [warn] The on_load function for module Elixir.ExFaiss.NIF returned:
{:error,
{:load_failed,
'Failed to load NIF library: \'dlopen(/Users/rakshan/Library/Caches/mix/installs/elixir-1.14.2-erts-13.1.2/a826da6aae061e7c6387a01df4160cd5/_build/dev/lib/ex_faiss/priv/libex_faiss.so, 0x0002): symbol not found in flat namespace \'___kmpc_barrier\'\''}}
Generated ex_faiss app
==> xla
Compiling 2 files (.ex)
Generated xla app
==> exla
Unpacking /Users/rakshan/Library/Caches/xla/0.4.4/cache/download/xla_extension-aarch64-darwin-cpu.tar.gz into /Users/rakshan/Library/Caches/mix/installs/elixir-1.14.2-erts-13.1.2/a826da6aae061e7c6387a01df4160cd5/deps/exla/cache
Using libexla.so from /Users/rakshan/Library/Caches/xla/exla/elixir-1.14.2-erts-13.1.2-xla-0.4.4-exla-0.5.1-4xbrruthhybd5baxjryp52phgi/libexla.so
Compiling 21 files (.ex)
Generated exla app
:ok
12:39:26.207 [warn] The on_load function for module Elixir.ExFaiss.NIF returned:
{:error,
{:load_failed,
'Failed to load NIF library: \'dlopen(/Users/rakshan/Library/Caches/mix/installs/elixir-1.14.2-erts-13.1.2/a826da6aae061e7c6387a01df4160cd5/_build/dev/lib/ex_faiss/priv/libex_faiss.so, 0x0002): symbol not found in flat namespace \'___kmpc_barrier\'\''}}
Creating an Index
index = ExFaiss.Index
ExFaiss.Index