Skip to content

Commit

Permalink
Merge pull request #77 from Enet4/change/faiss-v1.8.0
Browse files Browse the repository at this point in the history
Update bindings to faiss v1.8.0
  • Loading branch information
Enet4 committed Mar 27, 2024
2 parents 3cc97ff + f0820cb commit caf28db
Show file tree
Hide file tree
Showing 5 changed files with 1,779 additions and 1,667 deletions.
2 changes: 1 addition & 1 deletion faiss-sys/faiss
Submodule faiss updated 551 files
10 changes: 5 additions & 5 deletions faiss-sys/gen_bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
# Ensure that the submodule is updated and checked out in the intended revision
if ! which bindgen > /dev/null; then
echo "ERROR: `bindgen` not found. Please install using cargo:"
echo " cargo install bindgen"
echo " cargo install bindgen-cli --version=^0.69"
exit 1
fi

repo_url=https://github.com/facebookresearch/faiss
repo_rev=v1.7.2
repo_rev=v1.8.0
cuda_root=/opt/cuda

if [ ! -d faiss ]; then
git clone "$repo_url" faiss --branch "$repo_rev" --depth 1
fi

bindgen_opt='--size_t-is-usize --whitelist-function faiss_.* --whitelist-type idx_t|Faiss.* --opaque-type FILE'
bindgen_opt='--allowlist-function faiss_.* --allowlist-type idx_t|Faiss.* --opaque-type FILE'

headers=`ls faiss/c_api/*_c.h faiss/c_api/impl/*_c.h faiss/c_api/utils/*_c.h`
echo '// Auto-generated, do not edit!' > c_api.h
for header in $headers; do
echo "#include \""$header"\"" >> c_api.h;
done

cmd="bindgen --rust-target 1.33 $bindgen_opt c_api.h -o src/bindings.rs"
cmd="bindgen --rust-target 1.59 $bindgen_opt c_api.h -o src/bindings.rs"
echo ${cmd}
${cmd}

Expand All @@ -33,7 +33,7 @@ for header in $headers; do
echo "#include \""$header"\"" >> c_api.h;
done

cmd="bindgen --rust-target 1.33 $bindgen_opt c_api.h -o src/bindings_gpu.rs -- -Ifaiss/c_api -I$cuda_root/include"
cmd="bindgen --rust-target 1.59 $bindgen_opt c_api.h -o src/bindings_gpu.rs -- -Ifaiss/c_api -I$cuda_root/include"
echo ${cmd}
${cmd}

Expand Down
Loading

0 comments on commit caf28db

Please sign in to comment.