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

Hi, I have the same issue, after compiling on ARMv8 (Jetson Xavier). I ran configure and make with the options: #1909

Closed
apollo-bian opened this issue May 25, 2021 · 3 comments

Comments

@apollo-bian
Copy link

apollo-bian commented May 25, 2021

I install faiss-cpu on Huawei Kunpeng 920 (ARM based).

after installing two depended things
OpenBLAS, SWIG

I execute faiss install

tar -xf v1.6.1.tar.gz
cd faiss-1.6.1
export PYTHON=/usr/bin/python3.7
./configure --without-cuda
make –j
make install

compile interface for python

make -C python
make -C python install

try to import

import faiss
Traceback (most recent call last):
File "", line1, in
File "/usr/local/.../faiss/init.py", line38, in
instr_set = instruction_set()
File "/usr/local/.../faiss/init.py", line 31, in instruction_set
if "avx2" in numpy.distutils.cpuinfo.cpu.info[0]['flags']:
KeyError: 'flags'

platform.system()
"Linux"

since this is not intel platform
I modified the init.py, let the function instruction_set() always returns "default"

then to import

import faiss
...
...
Traceback (most recent call last):
File "/usr/local/.../faiss/swigfaiss.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/local/.../python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 670, in _load_unlocked
File "", line 583, in module_from_spec
File "", line 1043, in create_module
File "", line 219, in _call_with_frames_removed
ImportError: /usr/local/.../faiss/swigfaiss.so: undefined symbol: dgesvd

During handling of the above exception, another exception occurred:

File "", line1, in
File "/usr/local/.../faiss/init.py", line 50, in
from .swigfaiss import *
File "/usr/local/.../faiss/swigfaiss.py", line 17, in
_swigfaiss = swig_import_helper()
File "/usr/local/.../faiss/siwgfaiss.py", line 16, in swig_import_helper
return importlib.import_module('_swigfaiss')
File "/usr/local/.../python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_swigfaiss'

run command

swig -version

SWIG Version 3.0.12
Complied with g++ [aarch64-unknown-linux-gnu]
Configured options: +pcre
Please see http://..........

========================================================

Hi, I have the same issue, after compiling on ARMv8 (Jetson Xavier). I ran configure and make with the options:

./configure --with-cuda=/usr/local/cuda --with-cuda-arch="-gencode=arch=compute_53,code=sm_53 -gencode=arch=compute_72,code=sm_72"
make
make -C python
make -C python install

After importing Faiss in python, I see the "KeyError: flags". Running the following in a python interpreter, gives:

>>> import numpy.distutils.cpuinfo
>>> numpy.distutils.cpuinfo.cpu.info[0]
{'uname_m': 'aarch64', 'processor': '0', 'model name': 'ARMv8 Processor rev 0 (v8l)', 'BogoMIPS': '62.50', 'Features': 'fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp', 'CPU implementer': '0x4e', 'CPU architecture': '8', 'CPU variant': '0x0', 'CPU part': '0x004', 'CPU revision': '0', 'MTS version': '45309758'}

>>> import platform
>>> platform.system()
'Linux'

Originally posted by @gilbertfrancois in #1098 (comment)

@apollo-bian
Copy link
Author

I also trid this method: https://github.com/facebookresearch/faiss/wiki/Installing-Faiss#installing-faiss

after cmake
I cite some words showed on the console
--Could NOT find MKL (missing: MKL_LIBRARIES)

CMake Deprecation Warning at build/_deps/googletest-src/googletest/CMakeLists.txt:56(cmake_minimum_required):
compatibility with CMake < 2.8.12 will be removed from a future version of
CMake

-- Configuring done
-- Generating done
-- Build files have been written to: /home/faiss/build

Then go to build/faiss/python and build:

Traceback (most recent call last):
File "setup.py", line 29, in
f"Could not find {swigfaiss_generic_lib} or "
AssertionError: Could not find _swigfaiss.so or _swigfaiss_avx2.so. Faiss may not be compiled yet.

@alborotogarcia
Copy link

@apollo-bian I can successfully build v1.6.4 on ubuntu 20.04

@vorj
Copy link
Contributor

vorj commented Aug 24, 2021

@apollo-bian

ImportError: /usr/local/.../faiss/swigfaiss.so: undefined symbol: dgesvd

It seems that your OpenBLAS doesn't be enabled LAPACK feature. Would you check the build setting? (Please keep in mind that you will need FORTRAN compiler to enable LAPACK feature of OpenBLAS.)

@mdouze mdouze closed this as completed Apr 4, 2022
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

4 participants