Faiss: Compile in aarch64/arm64

Created on 17 Aug 2018  路  11Comments  路  Source: facebookresearch/faiss

Does faiss support aarch64/arm64 ?

  • I wanna compile faiss in nvidia Jestson TX2 which is the platform of Ubuntu 16.04 LTS aarch64, but I got the errors:
    c++: error: unrecognized command line option '-m64'
    c++: error: unrecognized command line option '-msse4'
    c++: error: unrecognized command line option '-mpopcnt'
  • So how can I fix the problem ? thanks !

Platform

OS:

  • Ubuntu 16.04 LTS aarch64

Faiss version:

  • 80314d9f07b17c3ef2d148f7490efa3bde8ae4ad

Faiss compilation options:

  • -std=c++11 -fPIC -m64 -Wall -g -O3 -msse4 -mpopcnt -fopenmp -Wno-sign-compare

Running on:

  • [x] CPU
  • [x] GPU

Interface:

  • [x] C++
  • [ ] Python
duplicate question

Most helpful comment

I met the same issue in 1.4.0. on tx2

g++ -std=c++11 -DFINTEGER=int -fPIC -fopenmp -m64 -Wno-sign-compare -g -O3 -Wall -Wextra -msse4 -mpopcnt -c IndexFlat.cpp -o IndexFlat.o
g++: error: unrecognized command line option '-m64'
g++: error: unrecognized command line option '-msse4'
g++: error: unrecognized command line option '-mpopcnt'
Makefile:27: recipe for target 'IndexFlat.o' failed

All 11 comments

The Faiss code will need some adaptation to run on a non-x64 platform, see #529.
If you want to give it a try, we will welcome PRs for a non-intel version of Faiss.

Here is a patch that makes it possible to compile on non x64 machines: https://gist.github.com/mdouze/a384a01d0e205bee6d39d52170fb3588
it disables or replaces with scalar code all x64-specific code.
Apparently arm also has SIMD instructions, it would be interesting to use those to speed up Faiss.

I have enabled for PowerPC by disabling Intel specific instructions. HNSW is not enabled.
Forked version here - https://github.com/msharmavikram/faiss

It should work for ARM too. (as PowerPC specific are guarded). Let me know if you see an issue.

Updated the patch
https://gist.github.com/mdouze/a384a01d0e205bee6d39d52170fb3588
to support IndexHNSW. All test pass on an ARM machine.

@mdouze How about the function of arm64 if compared with x86 ? Are they the same, or not ? Which part of source code has been modified if they not ? Thanks a lot !

In this patch, all the occurrences of SSE intrinsics are replaced with normal C code.

How to compile this project on arm64 ? : ] @mdouze

Please adjust the makefile.inc manually to remove x86-specific flags and it will compile. The next Faiss release will include some ARM optimized routines.

Compilation for arm is supported in 1.4.0

I met the same issue in 1.4.0. on tx2

g++ -std=c++11 -DFINTEGER=int -fPIC -fopenmp -m64 -Wno-sign-compare -g -O3 -Wall -Wextra -msse4 -mpopcnt -c IndexFlat.cpp -o IndexFlat.o
g++: error: unrecognized command line option '-m64'
g++: error: unrecognized command line option '-msse4'
g++: error: unrecognized command line option '-mpopcnt'
Makefile:27: recipe for target 'IndexFlat.o' failed

Please remove those 3 flags from makefile.inc. There is no specific flag needed to get the ARM NEON instructions.

Was this page helpful?
0 / 5 - 0 ratings