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

Undefined reference to GPU symbols when compiling 1.9.0 #4132

Open
vcampmany opened this issue Jan 22, 2025 · 0 comments
Open

Undefined reference to GPU symbols when compiling 1.9.0 #4132

vcampmany opened this issue Jan 22, 2025 · 0 comments
Labels

Comments

@vcampmany
Copy link

I compiled FAISS 1.9.0 from source following the instructions in INSTALL.md. Compilation is successful, however when I link the library to my application, I get undefined reference to GPU symbols. Until now, I've been using FAISS 1.7.3 in my C++ application without problems. The problem only came when trying to upgrade to 1.9.0.

I've been trying to find the root cause but I haven't been successful so far. Here is what I found out on the way.

First, this is how I'm compiling the library:

cmake -B build . -DFAISS_ENABLE_GPU=ON -DFAISS_ENABLE_PYTHON=OFF -DCUDAToolkit_ROOT=/usr/local/cuda -DCMAKE_CUDA_ARCHITECTURES=75 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
make -C build -j faiss

This generates a libfaiss.a file for both 1.9.0 and 1.7.3. However, the symbols have changed, 1.9.0 having only one "gpu" symbol after grep. here the results

  • For 1.9.0
$ nm libfaiss.a | grep gpu
0000000000000000 B _ZN5faiss19gpu_compile_optionsB5cxx11E
  • For 1.7.3
$ nm libfaiss.a | grep gpu
                 U _ZN5faiss3gpu13GpuIndexIVFPQ19setPrecomputedCodesEb
                 U _ZN5faiss3gpu16getMaxKSelectionEv
0000000000000380 T _ZN5faiss3gpu17GpuParameterSpace10initializeEPKNS_5IndexE
0000000000000010 t _ZN5faiss3gpu17GpuParameterSpace10initializeEPKNS_5IndexE.cold
0000000000000000 W _ZN5faiss3gpu17GpuParameterSpaceD0Ev
0000000000000000 W _ZN5faiss3gpu17GpuParameterSpaceD1Ev
0000000000000000 W _ZN5faiss3gpu17GpuParameterSpaceD2Ev
0000000000000000 n _ZN5faiss3gpu17GpuParameterSpaceD5Ev
                 U _ZNK5faiss3gpu11GpuIndexIVF11getNumListsEv
0000000000000000 T _ZNK5faiss3gpu17GpuParameterSpace19set_index_parameterEPNS_5IndexERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd
0000000000000000 t _ZNK5faiss3gpu17GpuParameterSpace19set_index_parameterEPNS_5IndexERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEd.cold
                 U _ZTIN5faiss3gpu11GpuIndexIVFE
                 U _ZTIN5faiss3gpu13GpuIndexIVFPQE
0000000000000000 V _ZTIN5faiss3gpu17GpuParameterSpaceE
0000000000000000 V _ZTSN5faiss3gpu17GpuParameterSpaceE
0000000000000000 V _ZTVN5faiss3gpu17GpuParameterSpaceE
00000000000009d0 T _ZN5faiss3gpu11ToCPUCloner11clone_IndexEPKNS_5IndexE
0000000000000026 t _ZN5faiss3gpu11ToCPUCloner11clone_IndexEPKNS_5IndexE.cold
0000000000000730 T _ZN5faiss3gpu11ToCPUCloner11merge_indexEPNS_5IndexES3_b
0000000000000000 W _ZN5faiss3gpu11ToCPUClonerD0Ev
0000000000000000 W _ZN5faiss3gpu11ToCPUClonerD1Ev
0000000000000000 W _ZN5faiss3gpu11ToCPUClonerD2Ev
0000000000000000 n _ZN5faiss3gpu11ToCPUClonerD5Ev
00000000000001f0 T _ZN5faiss3gpu11ToGpuCloner11clone_IndexEPKNS_5IndexE
....
....
....
(The list continues, shorten it for verbosity)

The absence of "gpu" symbols in 1.9.0 could explain why I'm getting undefined references in my application. Did anyone face this issue or am I doiong something wrong? Your help would be much appreciated. Thank you 🙁

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

No branches or pull requests

2 participants