Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making the C API more convenient to use #4181

Open
kaivalnp opened this issue Feb 9, 2025 · 6 comments
Open

Making the C API more convenient to use #4181

kaivalnp opened this issue Feb 9, 2025 · 6 comments

Comments

@kaivalnp
Copy link

kaivalnp commented Feb 9, 2025

  1. Can we start publishing the shared library for the C API (libfaiss_c.so) to Conda, so that users don't have to build it locally?
  2. libfaiss_c.so is currently linked to libfaiss.so, but we don't have optimized versions of the library (AVX2, AVX512, SVE, etc). This could be overcome offline with something like patchelf (replace libfaiss.so dependency with optimized version), but can we start creating (and publishing) equivalent versions of the C API like libfaiss_avx2.so -> libfaiss_c_avx2.so, etc
@mengdilin
Copy link
Contributor

@kaivalnp How did you access the C API libfaiss_c.so from conda installed faiss? AFAICT, we don't upload it to conda from looking at the conda build script https://github.com/facebookresearch/faiss/blob/main/conda/faiss/build-lib.sh#L11

If you want faiss to link to the right build from cmake, I think you can try replacing the linking with link_to_faiss_lib a utility that will link to the optimized faiss version that is being built like

include(../cmake/link_to_faiss_lib.cmake)
link_to_faiss_lib(faiss_test)

@kaivalnp
Copy link
Author

@mengdilin I built it locally, since it is not available from conda -- I opened this issue to ask for the C API to be published to conda so that users don't have to build it themselves

link_to_faiss_lib seems appropriate, but if we were to publish the C API to conda, we'll need separate versions of libfaiss_c.so (like libfaiss_c_avx2.so, libfaiss_c_avx512.so, etc) which are linked to the correct library (in line with optimized versions of libfaiss.so)

@mengdilin
Copy link
Contributor

Gotcha, will back it into a feature request and follow up with the team on the work

@kaivalnp
Copy link
Author

Thanks @mengdilin! Do let me know if I can help with some PRs (in case you agree with the suggestions)..

@mengdilin
Copy link
Contributor

@kaivalnp if you are happy to submit PRs to expose C-APIs to conda publication with validation steps, I am happy to review your PRs :D

Right now the team is a bit overwhelmed with other asks so we may not get to this ask as quickly

@kaivalnp
Copy link
Author

@mengdilin I'm not super familiar with the publish process (or the repo in general), but I took an attempt in #4186 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants