Move build to CMake (#1313)

Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1313

Reviewed By: mdouze

Differential Revision: D22948267

Pulled By: beauby

fbshipit-source-id: ec16fa0342f37672d46fb7886ecc55c7996011c4
This commit is contained in:
Lucas Hosseini
2020-08-14 15:03:10 -07:00
committed by Facebook GitHub Bot
parent 4c3b5ad156
commit a8e4c5e2d5
40 changed files with 1026 additions and 14638 deletions
+8 -28
View File
@@ -6,28 +6,6 @@ env:
matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
packages:
- libblas-dev
- liblapack-dev
- python-dev
# - swig3.0
env:
- PYTHON_CFLAGS="-I/usr/include/python2.7"
- os: linux
compiler: gcc
addons:
apt:
packages:
- libatlas-base-dev
- liblapack-dev
- python-dev
# - swig3.0
env:
- PYTHON_CFLAGS="-I/usr/include/python2.7"
- os: linux
compiler: gcc
addons:
@@ -60,6 +38,7 @@ matrix:
packages:
- gcc
- swig
- cmake
update: true
env:
- MATRIX_EVAL="which gcc; export CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++"
@@ -70,6 +49,7 @@ matrix:
packages:
- llvm
- swig
- cmake
update: true
env:
- MATRIX_EVAL="brew link --overwrite llvm; export CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++"
@@ -83,6 +63,7 @@ matrix:
packages:
- gcc
- swig
- cmake
update: true
env:
- MATRIX_EVAL="which gcc; export CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++"
@@ -93,11 +74,10 @@ before_install:
install:
- ./.travis/install.sh
- aclocal
- autoconf
- ./configure --without-cuda
- make
- make -C faiss/python
- PATH="$TRAVIS_BUILD_DIR/cmake/bin/:$PATH" cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF .
- make -C build -j
- (cd build/faiss/python && python setup.py build)
script:
- make test
- make -C build test
- PYTHONPATH="$(ls -d ./build/faiss/python/build/lib*/)" python -m unittest discover ./tests
+9
View File
@@ -12,6 +12,15 @@ function installswig() {
make install >/dev/null
}
function installcmake() {
cd /tmp/ &&
wget https://cmake.org/files/v3.17/cmake-3.17.0-Linux-x86_64.tar.gz &&
tar zxf cmake-3.17.0-Linux-x86_64.tar.gz &&
mkdir -p $TRAVIS_BUILD_DIR/cmake &&
cp -r cmake-3.17.0-Linux-x86_64/* $TRAVIS_BUILD_DIR/cmake
}
if [ "${TRAVIS_OS_NAME}" == linux ]; then
installswig
installcmake
fi
+51
View File
@@ -0,0 +1,51 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
project(faiss
VERSION 1.6.4
DESCRIPTION "A library for efficient similarity search and clustering of dense vectors."
HOMEPAGE_URL "https://github.com/facebookresearch/faiss"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Valid values are "generic", "sse4", "avx2".
option(FAISS_OPT_LEVEL "" "generic")
option(FAISS_ENABLE_GPU "Enable support for GPU indexes." ON)
option(FAISS_ENABLE_PYTHON "Build Python extension." ON)
if(FAISS_ENABLE_GPU)
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
enable_language(CUDA)
endif()
add_subdirectory(faiss)
if(FAISS_ENABLE_GPU)
add_subdirectory(faiss/gpu)
endif()
if(FAISS_ENABLE_PYTHON)
add_subdirectory(faiss/python)
endif()
add_subdirectory(demos)
add_subdirectory(tutorial/cpp)
if(BUILD_TESTING)
# CTest must be included in the top level to enable `make test` target.
include(CTest)
add_subdirectory(tests)
if(FAISS_ENABLE_GPU)
add_subdirectory(faiss/gpu/test)
endif()
endif()
+23 -40
View File
@@ -41,21 +41,26 @@ described separately (please see the [C interface installation file](c_api/INSTA
General compilation instructions
================================
TL;DR: `./configure && make (&& make install)` for the C++ library, and then `cd faiss/python; make && make install` for the python interface.
TL;DR:
```bash
cmake -B build .
make -C build
1. `./configure`
# For the Python interface:
cd faiss/python && python setup.py install
```
This generates the system-dependent configuration for the `Makefile`, stored in
a file called `makefile.inc`.
1. `cmake`
This generates the system-dependent configuration/build files.
A few useful options:
- `./configure --without-cuda` in order to build the CPU part only.
- `./configure --with-cuda=/path/to/cuda-10.1` in order to hint to the path of
- `-DFAISS_ENABLE_GPU=OFF` in order to build the CPU part only.
- `-DCUDAToolkit_ROOT=/path/to/cuda-10.1` in order to hint to the path of
the cudatoolkit.
- `./configure --with-cuda-arch="-gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_72,code=sm_72"` for specifying which GPU architectures to build against.
- `./configure --with-python=/path/to/python3.7` in order to build a python
- `-DCMAKE_CUDA_ARCHITECTURES="75;72"` for specifying which GPU architectures to build against.
- `-DPython_EXECUTABLE=/path/to/python3.7` in order to build a python
interface for a different python than the default one.
- `LDFLAGS=-L/path_to_mkl/lib/ ./configure` so that configure detects the MKL BLAS imeplementation. Note that this may require to set the LD_LIBRARY_PATH at runtime.
2. `make`
@@ -66,16 +71,7 @@ found, or the CPU part only otherwise).
This installs the headers and libraries.
4. `make -C faiss/python` (or `make py`)
This builds the python interface.
5. `make -C faiss/python install`
This installs the python library.
Faiss is supported on x86_64 machines on Linux and Mac OS.
Faiss is supported on x86_64 machines on Linux and Mac OS.
It has been found to run on other platforms as well, see [other platforms](https://github.com/facebookresearch/faiss/wiki/Related-projects#bindings-to-other-languages-and-porting-to-other-platforms)
Faiss requires a C++ compiler that understands:
@@ -83,8 +79,7 @@ Faiss requires a C++ compiler that understands:
- the GCC intrinsic for the popcount instruction,
- basic OpenMP.
There are a few examples for makefile.inc in the example_makefiles/
subdirectory. There are also indications for specific configurations in the
There are indications for specific configurations in the
troubleshooting section of the wiki.
https://github.com/facebookresearch/faiss/wiki/Troubleshooting
@@ -104,15 +99,12 @@ thus does not need an include path.
There are several BLAS implementations, depending on the OS and
machine. To have reasonable performance, the BLAS library should be
multithreaded. See the example makefile.inc's for hints and examples
on how to set the flags, or simply run the configure script:
`./configure`
multithreaded.
To check that the link flags are correct, and verify whether the
implementation uses 32 or 64 bit integers, you can
`make misc/test_blas`
`make test_blas`
and run
@@ -127,7 +119,7 @@ A basic usage example is in
`demos/demo_ivfpq_indexing`
which you can build by calling
`make -C demos demo_ivfpq_indexing`
`make demo_ivfpq_indexing`
It makes a small index, stores it and performs some searches. A normal
runtime is around 20s. With a fast machine and Intel MKL's BLAS it
@@ -137,8 +129,6 @@ To run the whole test suite:
`make test` (for the CPU part)
`make test_gpu` (for the GPU part)
A real-life benchmark
---------------------
@@ -163,14 +153,7 @@ setting a different index_key to find the indexing structure that
gives the best performance.
The Python interface
======================================
The Python interface is compiled with
`make -C faiss/python` (or `make py`)
How it works
Python Interface
------------
The Python interface is provided via SWIG (Simple Wrapper and
@@ -225,8 +208,8 @@ The GPU version is a superset of the CPU version. In addition it
requires the cuda compiler and related libraries (Cublas)
The nvcc-specific flags to pass to the compiler, based on your desired
compute capability can be customized by providing the `--with-cuda-arch` to
`./configure`. Only compute capability 3.5+ is supported. For example, we enable
compute capability can be customized by providing the `CMAKE_CUDA_ARCHITECTURES`
flag to CMake. Only compute capability 3.5+ is supported. For example, we enable
by default:
```
@@ -255,7 +238,7 @@ Testing the GPU implementation
Compile the example with
`make -C gpu/test demo_ivfpq_indexing_gpu`
`make demo_ivfpq_indexing_gpu`
This produce the GPU code equivalent to the CPU
demo_ivfpq_indexing. It also shows how to translate indexed from/to
-116
View File
@@ -1,116 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
-include makefile.inc
HEADERS = $(wildcard faiss/*.h faiss/impl/*.h faiss/utils/*.h)
SRC = $(wildcard faiss/*.cpp faiss/impl/*.cpp faiss/utils/*.cpp)
OBJ = $(SRC:.cpp=.o)
INSTALLDIRS = $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)/faiss
GPU_HEADERS = $(wildcard faiss/gpu/*.h faiss/gpu/impl/*.h faiss/gpu/impl/*.cuh \
faiss/gpu/utils/*.h faiss/gpu/utils/*.cuh)
GPU_CPPSRC = $(wildcard faiss/gpu/*.cpp faiss/gpu/impl/*.cpp \
faiss/gpu/utils/*.cpp)
GPU_CUSRC = $(wildcard faiss/gpu/*.cu faiss/gpu/impl/*.cu \
faiss/gpu/utils/*.cu faiss/gpu/utils/nvidia/*.cu \
faiss/gpu/utils/blockselect/*.cu faiss/gpu/utils/warpselect/*.cu)
GPU_SRC = $(GPU_CPPSRC) $(GPU_CUSRC)
GPU_CPPOBJ = $(GPU_CPPSRC:.cpp=.o)
GPU_CUOBJ = $(GPU_CUSRC:.cu=.o)
GPU_OBJ = $(GPU_CPPOBJ) $(GPU_CUOBJ)
ifneq ($(strip $(NVCC)),)
OBJ += $(GPU_OBJ)
HEADERS += $(GPU_HEADERS)
endif
CPPFLAGS += -I.
NVCCFLAGS += -I.
############################
# Building
all: libfaiss.a libfaiss.$(SHAREDEXT)
libfaiss.a: $(OBJ)
$(AR) r $@ $^
libfaiss.$(SHAREDEXT): $(OBJ)
$(CXX) $(SHAREDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
%.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -c $< -o $@
%.o: %.cu
$(NVCC) $(NVCCFLAGS) -g -O3 -c $< -o $@
clean:
rm -f libfaiss.a libfaiss.$(SHAREDEXT)
rm -f $(OBJ)
############################
# Installing
install: libfaiss.a libfaiss.$(SHAREDEXT) installdirs
cp libfaiss.a libfaiss.$(SHAREDEXT) $(DESTDIR)$(libdir)
tar cf - $(HEADERS) | tar xf - -C $(DESTDIR)$(includedir)/faiss/
installdirs:
$(MKDIR_P) $(INSTALLDIRS)
uninstall:
rm -f $(DESTDIR)$(libdir)/libfaiss.a \
$(DESTDIR)$(libdir)/libfaiss.$(SHAREDEXT)
rm -rf $(DESTDIR)$(includedir)/faiss
#############################
# Dependencies
-include depend
depend: $(SRC) $(GPU_SRC)
for i in $^; do \
$(CXXCPP) $(CPPFLAGS) -DCUDA_VERSION=7050 -x c++ -MM $$i; \
done > depend
#############################
# Python
py: libfaiss.a
$(MAKE) -C faiss/python
#############################
# Tests
test: libfaiss.a py
$(MAKE) -C tests run
PYTHONPATH=./faiss/python/build/`ls faiss/python/build | grep lib` \
$(PYTHON) -m unittest discover tests/ -v
test_gpu: libfaiss.a
$(MAKE) -C gpu/test run
PYTHONPATH=./faiss/python/build/`ls faiss/python/build | grep lib` \
$(PYTHON) -m unittest discover gpu/test/ -v
#############################
# Demos
demos: libfaiss.a
$(MAKE) -C demos
#############################
# Misc
misc/test_blas: misc/test_blas.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
.PHONY: all clean demos install installdirs py test test_gpu uninstall
-234
View File
@@ -1,234 +0,0 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_blas.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro looks for a library that implements the BLAS linear-algebra
# interface (see http://www.netlib.org/blas/). On success, it sets the
# BLAS_LIBS output variable to hold the requisite library linkages.
#
# To link with BLAS, you should link with:
#
# $BLAS_LIBS $LIBS $FLIBS
#
# in that order. FLIBS is the output variable of the
# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
# sometimes necessary in order to link with F77 libraries. Users will also
# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
# reason.
#
# Many libraries are searched for, from ATLAS to CXML to ESSL. The user
# may also use --with-blas=<lib> in order to use some specific BLAS
# library <lib>. In order to link successfully, however, be aware that you
# will probably need to use the same Fortran compiler (which can be set
# via the F77 env. var.) as was used to compile the BLAS library.
#
# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is
# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is
# not found. If ACTION-IF-FOUND is not specified, the default action will
# define HAVE_BLAS.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 15
AU_ALIAS([ACX_BLAS], [AX_BLAS])
AC_DEFUN([AX_BLAS], [
AC_PREREQ(2.50)
# AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
AC_REQUIRE([AC_CANONICAL_HOST])
ax_blas_ok=no
AC_ARG_WITH(blas,
[AS_HELP_STRING([--with-blas=<lib>], [use BLAS library <lib>])])
case $with_blas in
yes | "") ;;
no) ax_blas_ok=disable ;;
-* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;;
*) BLAS_LIBS="-l$with_blas" ;;
esac
OPENMP_LDFLAGS="$OPENMP_CXXFLAGS"
# Get fortran linker names of BLAS functions to check for.
# AC_F77_FUNC(sgemm)
# AC_F77_FUNC(dgemm)
sgemm=sgemm_
dgemm=dgemm_
ax_blas_save_LIBS="$LIBS"
LIBS="$LIBS $FLIBS"
# First, check BLAS_LIBS environment variable
if test $ax_blas_ok = no; then
if test "x$BLAS_LIBS" != x; then
save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes], [BLAS_LIBS=""])
AC_MSG_RESULT($ax_blas_ok)
LIBS="$save_LIBS"
fi
fi
# BLAS linked to by default? (happens on some supercomputers)
if test $ax_blas_ok = no; then
save_LIBS="$LIBS"; LIBS="$LIBS"
AC_MSG_CHECKING([if $sgemm is being linked in already])
AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes])
AC_MSG_RESULT($ax_blas_ok)
LIBS="$save_LIBS"
fi
# BLAS in Intel MKL library?
if test $ax_blas_ok = no; then
case $host_os in
darwin*)
AC_CHECK_LIB(mkl_intel_lp64, $sgemm,
[ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread"; OPENMP_LDFLAGS=""],,
[-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread])
;;
*)
if test $host_cpu = x86_64; then
AC_CHECK_LIB(mkl_intel_lp64, $sgemm,
[ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"],,
[-lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl])
elif test $host_cpu = i686; then
AC_CHECK_LIB(mkl_intel, $sgemm,
[ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"],,
[-lmkl_intel -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl])
fi
;;
esac
fi
# Old versions of MKL
if test $ax_blas_ok = no; then
AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread])
fi
# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/)
if test $ax_blas_ok = no; then
AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes
BLAS_LIBS="-lopenblas"])
fi
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
if test $ax_blas_ok = no; then
AC_CHECK_LIB(atlas, ATL_xerbla,
[AC_CHECK_LIB(f77blas, $sgemm,
[AC_CHECK_LIB(cblas, cblas_dgemm,
[ax_blas_ok=yes
BLAS_LIBS="-lcblas -lf77blas -latlas"],
[], [-lf77blas -latlas])],
[], [-latlas])])
fi
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
if test $ax_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm,
[AC_CHECK_LIB(dgemm, $dgemm,
[AC_CHECK_LIB(sgemm, $sgemm,
[ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
[], [-lblas])],
[], [-lblas])])
fi
# BLAS in Apple vecLib library?
if test $ax_blas_ok = no; then
save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
AC_MSG_CHECKING([for $sgemm in -framework vecLib])
AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"])
AC_MSG_RESULT($ax_blas_ok)
LIBS="$save_LIBS"
fi
# BLAS in Alpha CXML library?
if test $ax_blas_ok = no; then
AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"])
fi
# BLAS in Alpha DXML library? (now called CXML, see above)
if test $ax_blas_ok = no; then
AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"])
fi
# BLAS in Sun Performance library?
if test $ax_blas_ok = no; then
if test "x$GCC" != xyes; then # only works with Sun CC
AC_CHECK_LIB(sunmath, acosp,
[AC_CHECK_LIB(sunperf, $sgemm,
[BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
ax_blas_ok=yes],[],[-lsunmath])])
fi
fi
# BLAS in SCSL library? (SGI/Cray Scientific Library)
if test $ax_blas_ok = no; then
AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"])
fi
# BLAS in SGIMATH library?
if test $ax_blas_ok = no; then
AC_CHECK_LIB(complib.sgimath, $sgemm,
[ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
fi
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
if test $ax_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm,
[AC_CHECK_LIB(essl, $sgemm,
[ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
[], [-lblas $FLIBS])])
fi
# Generic BLAS library?
if test $ax_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"])
fi
AC_SUBST(BLAS_LIBS)
AC_SUBST(OPENMP_LDFLAGS)
LIBS="$ax_blas_save_LIBS"
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_blas_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])
:
else
ax_blas_ok=no
$2
fi
])dnl AX_BLAS
-26
View File
@@ -1,26 +0,0 @@
# serial 1
AC_DEFUN([AX_CPU_ARCH], [
AC_MSG_CHECKING([for cpu arch])
AC_CANONICAL_TARGET
case $target in
amd64-* | x86_64-*)
ARCH_CPUFLAGS="-mpopcnt -msse4"
ARCH_CXXFLAGS="-m64"
;;
aarch64*-*)
dnl This is an arch for Nvidia Xavier a proper detection would be nice.
ARCH_CPUFLAGS="-march=armv8.2-a"
;;
*) ;;
esac
AC_MSG_RESULT([$target CPUFLAGS+="$ARCH_CPUFLAGS" CXXFLAGS+="$ARCH_CXXFLAGS"])
AC_SUBST(ARCH_CPUFLAGS)
AC_SUBST(ARCH_CXXFLAGS)
])dnl
-972
View File
@@ -1,972 +0,0 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the specified
# version of the C++ standard. If necessary, add switches to CXX and
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
# or '14' (for the C++14 standard).
#
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
# preference for an extended mode.
#
# The third argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline support for the specified C++ standard is
# required and that the macro should error out if no mode with that
# support is found. If specified 'optional', then configuration proceeds
# regardless, after defining HAVE_CXX${VERSION} if and only if a
# supporting mode is found.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <[email protected]>
# Copyright (c) 2012 Zack Weinberg <[email protected]>
# Copyright (c) 2013 Roy Stogner <[email protected]>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <[email protected]>
# Copyright (c) 2015 Paul Norman <[email protected]>
# Copyright (c) 2015 Moritz Klammler <[email protected]>
# Copyright (c) 2016, 2018 Krzesimir Nowak <[email protected]>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 9
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [],
[$2], [ext], [],
[$2], [noext], [],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
AC_LANG_PUSH([C++])dnl
ac_success=no
m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
switch="-std=gnu++${alternative}"
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
fi])
m4_if([$2], [ext], [], [dnl
if test x$ac_success = xno; then
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
if test x$ac_success = xyes; then
break
fi
done
fi])
AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
fi
fi
if test x$ac_success = xno; then
HAVE_CXX$1=0
AC_MSG_NOTICE([No compiler with C++$1 support was found])
else
HAVE_CXX$1=1
AC_DEFINE(HAVE_CXX$1,1,
[define if the compiler supports basic C++$1 syntax])
fi
AC_SUBST(HAVE_CXX$1)
])
dnl Test body for checking C++11 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
)
dnl Test body for checking C++14 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
)
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
)
dnl Tests for new features in C++11
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
// If the compiler admits that it is not ready for C++11, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201103L
#error "This is not a C++11 compiler"
#else
namespace cxx11
{
namespace test_static_assert
{
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
}
namespace test_final_override
{
struct Base
{
virtual void f() {}
};
struct Derived : public Base
{
virtual void f() override {}
};
}
namespace test_double_right_angle_brackets
{
template < typename T >
struct check {};
typedef check<void> single_type;
typedef check<check<void>> double_type;
typedef check<check<check<void>>> triple_type;
typedef check<check<check<check<void>>>> quadruple_type;
}
namespace test_decltype
{
int
f()
{
int a = 1;
decltype(a) b = 2;
return a + b;
}
}
namespace test_type_deduction
{
template < typename T1, typename T2 >
struct is_same
{
static const bool value = false;
};
template < typename T >
struct is_same<T, T>
{
static const bool value = true;
};
template < typename T1, typename T2 >
auto
add(T1 a1, T2 a2) -> decltype(a1 + a2)
{
return a1 + a2;
}
int
test(const int c, volatile int v)
{
static_assert(is_same<int, decltype(0)>::value == true, "");
static_assert(is_same<int, decltype(c)>::value == false, "");
static_assert(is_same<int, decltype(v)>::value == false, "");
auto ac = c;
auto av = v;
auto sumi = ac + av + 'x';
auto sumf = ac + av + 1.0;
static_assert(is_same<int, decltype(ac)>::value == true, "");
static_assert(is_same<int, decltype(av)>::value == true, "");
static_assert(is_same<int, decltype(sumi)>::value == true, "");
static_assert(is_same<int, decltype(sumf)>::value == false, "");
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
return (sumf > 0.0) ? sumi : add(c, v);
}
}
namespace test_noexcept
{
int f() { return 0; }
int g() noexcept { return 0; }
static_assert(noexcept(f()) == false, "");
static_assert(noexcept(g()) == true, "");
}
namespace test_constexpr
{
template < typename CharT >
unsigned long constexpr
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
{
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
}
template < typename CharT >
unsigned long constexpr
strlen_c(const CharT *const s) noexcept
{
return strlen_c_r(s, 0UL);
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("1") == 1UL, "");
static_assert(strlen_c("example") == 7UL, "");
static_assert(strlen_c("another\0example") == 7UL, "");
}
namespace test_rvalue_references
{
template < int N >
struct answer
{
static constexpr int value = N;
};
answer<1> f(int&) { return answer<1>(); }
answer<2> f(const int&) { return answer<2>(); }
answer<3> f(int&&) { return answer<3>(); }
void
test()
{
int i = 0;
const int c = 0;
static_assert(decltype(f(i))::value == 1, "");
static_assert(decltype(f(c))::value == 2, "");
static_assert(decltype(f(0))::value == 3, "");
}
}
namespace test_uniform_initialization
{
struct test
{
static const int zero {};
static const int one {1};
};
static_assert(test::zero == 0, "");
static_assert(test::one == 1, "");
}
namespace test_lambdas
{
void
test1()
{
auto lambda1 = [](){};
auto lambda2 = lambda1;
lambda1();
lambda2();
}
int
test2()
{
auto a = [](int i, int j){ return i + j; }(1, 2);
auto b = []() -> int { return '0'; }();
auto c = [=](){ return a + b; }();
auto d = [&](){ return c; }();
auto e = [a, &b](int x) mutable {
const auto identity = [](int y){ return y; };
for (auto i = 0; i < a; ++i)
a += b--;
return x + identity(a + b);
}(0);
return a + b + c + d + e;
}
int
test3()
{
const auto nullary = [](){ return 0; };
const auto unary = [](int x){ return x; };
using nullary_t = decltype(nullary);
using unary_t = decltype(unary);
const auto higher1st = [](nullary_t f){ return f(); };
const auto higher2nd = [unary](nullary_t f1){
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
};
return higher1st(nullary) + higher2nd(nullary)(unary);
}
}
namespace test_variadic_templates
{
template <int...>
struct sum;
template <int N0, int... N1toN>
struct sum<N0, N1toN...>
{
static constexpr auto value = N0 + sum<N1toN...>::value;
};
template <>
struct sum<>
{
static constexpr auto value = 0;
};
static_assert(sum<>::value == 0, "");
static_assert(sum<1>::value == 1, "");
static_assert(sum<23>::value == 23, "");
static_assert(sum<1, 2>::value == 3, "");
static_assert(sum<5, 5, 11>::value == 21, "");
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
}
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
// because of this.
namespace test_template_alias_sfinae
{
struct foo {};
template<typename T>
using member = typename T::member_type;
template<typename T>
void func(...) {}
template<typename T>
void func(member<T>*) {}
void test();
void test() { func<foo>(0); }
}
} // namespace cxx11
#endif // __cplusplus >= 201103L
]])
dnl Tests for new features in C++14
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
// If the compiler admits that it is not ready for C++14, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201402L
#error "This is not a C++14 compiler"
#else
namespace cxx14
{
namespace test_polymorphic_lambdas
{
int
test()
{
const auto lambda = [](auto&&... args){
const auto istiny = [](auto x){
return (sizeof(x) == 1UL) ? 1 : 0;
};
const int aretiny[] = { istiny(args)... };
return aretiny[0];
};
return lambda(1, 1L, 1.0f, '1');
}
}
namespace test_binary_literals
{
constexpr auto ivii = 0b0000000000101010;
static_assert(ivii == 42, "wrong value");
}
namespace test_generalized_constexpr
{
template < typename CharT >
constexpr unsigned long
strlen_c(const CharT *const s) noexcept
{
auto length = 0UL;
for (auto p = s; *p; ++p)
++length;
return length;
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("x") == 1UL, "");
static_assert(strlen_c("test") == 4UL, "");
static_assert(strlen_c("another\0test") == 7UL, "");
}
namespace test_lambda_init_capture
{
int
test()
{
auto x = 0;
const auto lambda1 = [a = x](int b){ return a + b; };
const auto lambda2 = [a = lambda1(x)](){ return a; };
return lambda2();
}
}
namespace test_digit_separators
{
constexpr auto ten_million = 100'000'000;
static_assert(ten_million == 100000000, "");
}
namespace test_return_type_deduction
{
auto f(int& x) { return x; }
decltype(auto) g(int& x) { return x; }
template < typename T1, typename T2 >
struct is_same
{
static constexpr auto value = false;
};
template < typename T >
struct is_same<T, T>
{
static constexpr auto value = true;
};
int
test()
{
auto x = 0;
static_assert(is_same<int, decltype(f(x))>::value, "");
static_assert(is_same<int&, decltype(g(x))>::value, "");
return x;
}
}
} // namespace cxx14
#endif // __cplusplus >= 201402L
]])
dnl Tests for new features in C++17
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
// If the compiler admits that it is not ready for C++17, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus <= 201402L
#error "This is not a C++17 compiler"
#else
#if defined(__clang__)
#define REALLY_CLANG
#else
#if defined(__GNUC__)
#define REALLY_GCC
#endif
#endif
#include <initializer_list>
#include <utility>
#include <type_traits>
namespace cxx17
{
#if !defined(REALLY_CLANG)
namespace test_constexpr_lambdas
{
// TODO: test it with clang++ from git
constexpr int foo = [](){return 42;}();
}
#endif // !defined(REALLY_CLANG)
namespace test::nested_namespace::definitions
{
}
namespace test_fold_expression
{
template<typename... Args>
int multiply(Args... args)
{
return (args * ... * 1);
}
template<typename... Args>
bool all(Args... args)
{
return (args && ...);
}
}
namespace test_extended_static_assert
{
static_assert (true);
}
namespace test_auto_brace_init_list
{
auto foo = {5};
auto bar {5};
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
static_assert(std::is_same<int, decltype(bar)>::value);
}
namespace test_typename_in_template_template_parameter
{
template<template<typename> typename X> struct D;
}
namespace test_fallthrough_nodiscard_maybe_unused_attributes
{
int f1()
{
return 42;
}
[[nodiscard]] int f2()
{
[[maybe_unused]] auto unused = f1();
switch (f1())
{
case 17:
f1();
[[fallthrough]];
case 42:
f1();
}
return f1();
}
}
namespace test_extended_aggregate_initialization
{
struct base1
{
int b1, b2 = 42;
};
struct base2
{
base2() {
b3 = 42;
}
int b3;
};
struct derived : base1, base2
{
int d;
};
derived d1 {{1, 2}, {}, 4}; // full initialization
derived d2 {{}, {}, 4}; // value-initialized bases
}
namespace test_general_range_based_for_loop
{
struct iter
{
int i;
int& operator* ()
{
return i;
}
const int& operator* () const
{
return i;
}
iter& operator++()
{
++i;
return *this;
}
};
struct sentinel
{
int i;
};
bool operator== (const iter& i, const sentinel& s)
{
return i.i == s.i;
}
bool operator!= (const iter& i, const sentinel& s)
{
return !(i == s);
}
struct range
{
iter begin() const
{
return {0};
}
sentinel end() const
{
return {5};
}
};
void f()
{
range r {};
for (auto i : r)
{
[[maybe_unused]] auto v = i;
}
}
}
namespace test_lambda_capture_asterisk_this_by_value
{
struct t
{
int i;
int foo()
{
return [*this]()
{
return i;
}();
}
};
}
namespace test_enum_class_construction
{
enum class byte : unsigned char
{};
byte foo {42};
}
namespace test_constexpr_if
{
template <bool cond>
int f ()
{
if constexpr(cond)
{
return 13;
}
else
{
return 42;
}
}
}
namespace test_selection_statement_with_initializer
{
int f()
{
return 13;
}
int f2()
{
if (auto i = f(); i > 0)
{
return 3;
}
switch (auto i = f(); i + 4)
{
case 17:
return 2;
default:
return 1;
}
}
}
#if !defined(REALLY_CLANG)
namespace test_template_argument_deduction_for_class_templates
{
// TODO: test it with clang++ from git
template <typename T1, typename T2>
struct pair
{
pair (T1 p1, T2 p2)
: m1 {p1},
m2 {p2}
{}
T1 m1;
T2 m2;
};
void f()
{
[[maybe_unused]] auto p = pair{13, 42u};
}
}
#endif // !defined(REALLY_CLANG)
namespace test_non_type_auto_template_parameters
{
template <auto n>
struct B
{};
B<5> b1;
B<'a'> b2;
}
#if !defined(REALLY_CLANG)
namespace test_structured_bindings
{
// TODO: test it with clang++ from git
int arr[2] = { 1, 2 };
std::pair<int, int> pr = { 1, 2 };
auto f1() -> int(&)[2]
{
return arr;
}
auto f2() -> std::pair<int, int>&
{
return pr;
}
struct S
{
int x1 : 2;
volatile double y1;
};
S f3()
{
return {};
}
auto [ x1, y1 ] = f1();
auto& [ xr1, yr1 ] = f1();
auto [ x2, y2 ] = f2();
auto& [ xr2, yr2 ] = f2();
const auto [ x3, y3 ] = f3();
}
#endif // !defined(REALLY_CLANG)
#if !defined(REALLY_CLANG)
namespace test_exception_spec_type_system
{
// TODO: test it with clang++ from git
struct Good {};
struct Bad {};
void g1() noexcept;
void g2();
template<typename T>
Bad
f(T*, T*);
template<typename T1, typename T2>
Good
f(T1*, T2*);
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
}
#endif // !defined(REALLY_CLANG)
namespace test_inline_variables
{
template<class T> void f(T)
{}
template<class T> inline T g(T)
{
return T{};
}
template<> inline void f<>(int)
{}
template<> int g<>(int)
{
return 5;
}
}
} // namespace cxx17
#endif // __cplusplus <= 201402L
]])
-132
View File
@@ -1,132 +0,0 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_lapack.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro looks for a library that implements the LAPACK linear-algebra
# interface (see http://www.netlib.org/lapack/). On success, it sets the
# LAPACK_LIBS output variable to hold the requisite library linkages.
#
# To link with LAPACK, you should link with:
#
# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS
#
# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro,
# called automatically. FLIBS is the output variable of the
# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
# sometimes necessary in order to link with F77 libraries. Users will also
# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
# reason.
#
# The user may also use --with-lapack=<lib> in order to use some specific
# LAPACK library <lib>. In order to link successfully, however, be aware
# that you will probably need to use the same Fortran compiler (which can
# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS
# libraries.
#
# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_LAPACK.
#
# LICENSE
#
# Copyright (c) 2009 Steven G. Johnson <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 8
AU_ALIAS([ACX_LAPACK], [AX_LAPACK])
AC_DEFUN([AX_LAPACK], [
AC_REQUIRE([AX_BLAS])
ax_lapack_ok=no
AC_ARG_WITH(lapack,
[AS_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])])
case $with_lapack in
yes | "") ;;
no) ax_lapack_ok=disable ;;
-* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;;
*) LAPACK_LIBS="-l$with_lapack" ;;
esac
# Get fortran linker name of LAPACK function to check for.
# AC_F77_FUNC(cheev)
cheev=cheev_
# We cannot use LAPACK if BLAS is not found
if test "x$ax_blas_ok" != xyes; then
ax_lapack_ok=noblas
LAPACK_LIBS=""
fi
# First, check LAPACK_LIBS environment variable
if test "x$LAPACK_LIBS" != x; then
save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS])
AC_TRY_LINK_FUNC($cheev, [ax_lapack_ok=yes], [LAPACK_LIBS=""])
AC_MSG_RESULT($ax_lapack_ok)
LIBS="$save_LIBS"
if test $ax_lapack_ok = no; then
LAPACK_LIBS=""
fi
fi
# LAPACK linked to by default? (is sometimes included in BLAS lib)
if test $ax_lapack_ok = no; then
save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes])
LIBS="$save_LIBS"
fi
# Generic LAPACK library?
for lapack in lapack lapack_rs6k; do
if test $ax_lapack_ok = no; then
save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
AC_CHECK_LIB($lapack, $cheev,
[ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
LIBS="$save_LIBS"
fi
done
AC_SUBST(LAPACK_LIBS)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_lapack_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1])
:
else
ax_lapack_ok=no
$2
fi
])dnl AX_LAPACK
-67
View File
@@ -1,67 +0,0 @@
AC_DEFUN([FA_CHECK_CUDA], [
AC_ARG_WITH(cuda,
[AS_HELP_STRING([--with-cuda=<prefix>], [prefix of the CUDA installation])])
AC_ARG_WITH(cuda-arch,
[AS_HELP_STRING([--with-cuda-arch=<gencodes>], [device specific -gencode flags])],
[],
[with_cuda_arch=default])
if test x$with_cuda != xno; then
if test x$with_cuda != x; then
cuda_prefix=$with_cuda
AC_CHECK_PROG(NVCC, [nvcc], [$cuda_prefix/bin/nvcc], [], [$cuda_prefix/bin])
NVCC_CPPFLAGS="-I$cuda_prefix/include"
NVCC_LDFLAGS="-L$cuda_prefix/lib64"
else
AC_CHECK_PROGS(NVCC, [nvcc /usr/local/cuda/bin/nvcc], [])
if test "x$NVCC" == "x/usr/local/cuda/bin/nvcc"; then
cuda_prefix="/usr/local/cuda"
NVCC_CPPFLAGS="-I$cuda_prefix/include"
NVCC_LDFLAGS="-L$cuda_prefix/lib64"
else
cuda_prefix=""
NVCC_CPPFLAGS=""
NVCC_LDFLAGS=""
fi
fi
if test "x$NVCC" == x; then
AC_MSG_ERROR([Couldn't find nvcc])
fi
if test "x$with_cuda_arch" == xdefault; then
with_cuda_arch="-gencode=arch=compute_35,code=compute_35 \\
-gencode=arch=compute_52,code=compute_52 \\
-gencode=arch=compute_60,code=compute_60 \\
-gencode=arch=compute_61,code=compute_61 \\
-gencode=arch=compute_70,code=compute_70 \\
-gencode=arch=compute_75,code=compute_75"
fi
fa_save_CPPFLAGS="$CPPFLAGS"
fa_save_LDFLAGS="$LDFLAGS"
fa_save_LIBS="$LIBS"
CPPFLAGS="$NVCC_CPPFLAGS $CPPFLAGS"
LDFLAGS="$NVCC_LDFLAGS $LDFLAGS"
AC_CHECK_HEADER([cuda.h], [], AC_MSG_FAILURE([Couldn't find cuda.h]))
AC_CHECK_LIB([cublas], [cublasAlloc], [], AC_MSG_FAILURE([Couldn't find libcublas]))
AC_CHECK_LIB([cudart], [cudaSetDevice], [], AC_MSG_FAILURE([Couldn't find libcudart]))
NVCC_LIBS="$LIBS"
NVCC_CPPFLAGS="$CPPFLAGS"
NVCC_LDFLAGS="$LDFLAGS"
CPPFLAGS="$fa_save_CPPFLAGS"
LDFLAGS="$fa_save_LDFLAGS"
LIBS="$fa_save_LIBS"
fi
AC_SUBST(NVCC)
AC_SUBST(NVCC_CPPFLAGS)
AC_SUBST(NVCC_LDFLAGS)
AC_SUBST(NVCC_LIBS)
AC_SUBST(CUDA_PREFIX, $cuda_prefix)
AC_SUBST(CUDA_ARCH, $with_cuda_arch)
])
-20
View File
@@ -1,20 +0,0 @@
AC_DEFUN([FA_NUMPY], [
AC_REQUIRE([FA_PYTHON])
AC_MSG_CHECKING([for numpy headers path])
fa_numpy_headers=`$PYTHON -c "import numpy; print(numpy.get_include())"`
if test $? == 0; then
if test x$fa_numpy_headers != x; then
AC_MSG_RESULT($fa_numpy_headers)
AC_SUBST(NUMPY_INCLUDE, $fa_numpy_headers)
else
AC_MSG_RESULT([not found])
AC_MSG_WARN([You won't be able to build the python interface.])
fi
else
AC_MSG_RESULT([not found])
AC_MSG_WARN([You won't be able to build the python interface.])
fi
])dnl
-16
View File
@@ -1,16 +0,0 @@
dnl
dnl Check for an nm(1) utility.
dnl
AC_DEFUN([FA_PROG_NM],
[
case "${NM-unset}" in
unset) AC_CHECK_PROGS(NM, nm, nm) ;;
*) AC_CHECK_PROGS(NM, $NM nm, nm) ;;
esac
AC_MSG_CHECKING(nm flags)
case "${NMFLAGS-unset}" in
unset) NMFLAGS= ;;
esac
AC_MSG_RESULT($NMFLAGS)
AC_SUBST(NMFLAGS)
])
-11
View File
@@ -1,11 +0,0 @@
AC_DEFUN([FA_PROG_SWIG], [
AC_ARG_WITH(swig,
[AS_HELP_STRING([--with-swig=<bin>], [use SWIG binary <bin>])])
case $with_swig in
"") AC_CHECK_PROG(SWIG, swig, swig);;
*) SWIG="$with_swig"
esac
AC_SUBST(SWIG)
])
-21
View File
@@ -1,21 +0,0 @@
AC_DEFUN([FA_PYTHON], [
AC_ARG_WITH(python,
[AS_HELP_STRING([--with-python=<bin>], [use Python binary <bin>])])
case $with_python in
"") PYTHON_BIN=python ;;
*) PYTHON_BIN="$with_python"
esac
AC_CHECK_PROG(PYTHON, $PYTHON_BIN, $PYTHON_BIN)
fa_python_bin=$PYTHON
AC_MSG_CHECKING([for Python C flags])
fa_python_cflags=`$PYTHON -c "
import sysconfig
paths = [['-I' + sysconfig.get_path(p) for p in ['include', 'platinclude']]]
print(' '.join(paths))"`
AC_MSG_RESULT($fa_python_cflags)
AC_SUBST(PYTHON_CFLAGS, "$PYTHON_CFLAGS $fa_python_cflags")
])dnl FA_PYTHON
-1473
View File
File diff suppressed because it is too large Load Diff
-1836
View File
File diff suppressed because it is too large Load Diff
-501
View File
@@ -1,501 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2016-01-11.22; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
+365
View File
@@ -0,0 +1,365 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from CMake's FindBLAS module.
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindMKL
--------
Find Intel MKL library.
Input Variables
^^^^^^^^^^^^^^^
The following variables may be set to influence this module's behavior:
``BLA_STATIC``
if ``ON`` use static linkage
``BLA_VENDOR``
If set, checks only the specified vendor, if not set checks all the
possibilities. List of vendors valid in this module:
* ``Intel10_32`` (intel mkl v10 32 bit)
* ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model)
* ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model)
* ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model)
* ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model)
* ``Intel10_64_dyn`` (intel mkl v10+ 64 bit, single dynamic library)
* ``Intel`` (obsolete versions of mkl 32 and 64 bit)
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``BLAS_FOUND``
library implementing the BLAS interface is found
``BLAS_LINKER_FLAGS``
uncached list of required linker flags (excluding ``-l`` and ``-L``).
``BLAS_LIBRARIES``
uncached list of libraries (using full path name) to link against
to use BLAS (may be empty if compiler implicitly links BLAS)
.. note::
C or CXX must be enabled to use Intel Math Kernel Library (MKL).
For example, to use Intel MKL libraries and/or Intel compiler:
.. code-block:: cmake
set(BLA_VENDOR Intel10_64lp)
find_package(BLAS)
Hints
^^^^^
Set the ``MKLROOT`` environment variable to a directory that contains an MKL
installation, or add the directory to the dynamic library loader environment
variable for your platform (``LIB``, ``DYLD_LIBRARY_PATH`` or
``LD_LIBRARY_PATH``).
#]=======================================================================]
include(CheckFunctionExists)
include(CMakePushCheckState)
include(FindPackageHandleStandardArgs)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(BLA_STATIC)
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
else()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# for ubuntu's libblas3gf and liblapack3gf packages
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
endif()
endif()
macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _addlibdir _subdirs)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the
# Check_Fortran_Function_Exists macro) whether can link against that library
# combination using the name of a routine given by _name using the linker
# flags given by _flags. If the combination of libraries is found and passes
# the link test, LIBRARIES is set to the list of complete library paths that
# have been found. Otherwise, LIBRARIES is set to FALSE.
# N.B. _prefix is the prefix applied to the names of all cached variables that
# are generated internally and marked advanced by this macro.
# _addlibdir is a list of additional search paths. _subdirs is a list of path
# suffixes to be used by find_library().
set(_libraries_work TRUE)
set(${LIBRARIES})
set(_combined_name)
set(_extaddlibdir "${_addlibdir}")
if(WIN32)
list(APPEND _extaddlibdir ENV LIB)
elseif(APPLE)
list(APPEND _extaddlibdir ENV DYLD_LIBRARY_PATH)
else()
list(APPEND _extaddlibdir ENV LD_LIBRARY_PATH)
endif()
list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
foreach(_library ${_list})
if(_library MATCHES "^-Wl,--(start|end)-group$")
# Respect linker flags like --start/end-group (required by MKL)
set(${LIBRARIES} ${${LIBRARIES}} "${_library}")
else()
set(_combined_name ${_combined_name}_${_library})
if(NOT "${_threadlibs}" STREQUAL "")
set(_combined_name ${_combined_name}_threadlibs)
endif()
if(_libraries_work)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS ${_extaddlibdir}
PATH_SUFFIXES ${_subdirs}
)
#message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}")
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
endif()
endif()
endforeach()
if(_libraries_work)
# Test this combination of libraries.
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threadlibs})
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
if(CMAKE_Fortran_COMPILER_LOADED)
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
else()
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
endif()
set(CMAKE_REQUIRED_LIBRARIES)
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
endif()
if(_libraries_work)
if("${_list}" STREQUAL "")
set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
else()
set(${LIBRARIES} ${${LIBRARIES}} ${_threadlibs})
endif()
else()
set(${LIBRARIES} FALSE)
endif()
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro()
set(BLAS_LIBRARIES)
if(NOT $ENV{BLA_VENDOR} STREQUAL "")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else()
if(NOT BLA_VENDOR)
set(BLA_VENDOR "All")
endif()
endif()
if(BLA_VENDOR_THREADING)
set(BLAS_mkl_THREADING ${BLA_VENDOR_THREADING})
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(BLAS_mkl_THREADING "gnu")
else()
set(BLAS_mkl_THREADING "intel")
endif()
endif()
if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
# System-specific settings
if(WIN32)
if(BLA_STATIC)
set(BLAS_mkl_DLL_SUFFIX "")
else()
set(BLAS_mkl_DLL_SUFFIX "_dll")
endif()
else()
if(BLA_STATIC)
set(BLAS_mkl_START_GROUP "-Wl,--start-group")
set(BLAS_mkl_END_GROUP "-Wl,--end-group")
else()
set(BLAS_mkl_START_GROUP "")
set(BLAS_mkl_END_GROUP "")
endif()
if(BLAS_mkl_THREADING STREQUAL "gnu")
set(BLAS_mkl_OMP "gomp")
else()
set(BLAS_mkl_OMP "iomp5")
endif()
set(BLAS_mkl_LM "-lm")
set(BLAS_mkl_LDL "-ldl")
endif()
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
find_package(Threads)
else()
find_package(Threads REQUIRED)
endif()
set(BLAS_mkl_INTFACE "intel")
if(BLA_VENDOR MATCHES "_64ilp")
set(BLAS_mkl_ILP_MODE "ilp64")
else()
set(BLAS_mkl_ILP_MODE "lp64")
endif()
set(BLAS_SEARCH_LIBS "")
set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES)
if(WIN32)
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
endif()
if(BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
"mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}")
endif()
# Add threading/sequential libs
set(BLAS_SEARCH_LIBS_WIN_THREAD "")
if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
# mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
endif()
if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
"mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
endif()
# Cartesian product of the above
foreach(MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
foreach(THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
list(APPEND BLAS_SEARCH_LIBS
"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
endforeach()
endforeach()
else()
if(BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS
"mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
# mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS
"${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}")
endif()
if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
# old version
list(APPEND BLAS_SEARCH_LIBS
"mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
# mkl >= 10.3
list(APPEND BLAS_SEARCH_LIBS
"${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}")
endif()
if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core ${BLAS_mkl_END_GROUP}")
endif()
#older vesions of intel mkl libs
if(BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
list(APPEND BLAS_SEARCH_LIBS
"mkl")
list(APPEND BLAS_SEARCH_LIBS
"mkl_ia32")
list(APPEND BLAS_SEARCH_LIBS
"mkl_em64t")
endif()
endif()
if(BLA_VENDOR MATCHES "^Intel10_64_dyn$" OR BLA_VENDOR STREQUAL "All")
# mkl >= 10.3 with single dynamic library
list(APPEND BLAS_SEARCH_LIBS
"mkl_rt")
endif()
# MKL uses a multitude of partially platform-specific subdirectories:
if(BLA_VENDOR STREQUAL "Intel10_32")
set(BLAS_mkl_ARCH_NAME "ia32")
else()
set(BLAS_mkl_ARCH_NAME "intel64")
endif()
if(WIN32)
set(BLAS_mkl_OS_NAME "win")
elseif(APPLE)
set(BLAS_mkl_OS_NAME "mac")
else()
set(BLAS_mkl_OS_NAME "lin")
endif()
if(DEFINED ENV{MKLROOT})
file(TO_CMAKE_PATH "$ENV{MKLROOT}" BLAS_mkl_MKLROOT)
# If MKLROOT points to the subdirectory 'mkl', use the parent directory instead
# so we can better detect other relevant libraries in 'compiler' or 'tbb':
get_filename_component(BLAS_mkl_MKLROOT_LAST_DIR "${BLAS_mkl_MKLROOT}" NAME)
if(BLAS_mkl_MKLROOT_LAST_DIR STREQUAL "mkl")
get_filename_component(BLAS_mkl_MKLROOT "${BLAS_mkl_MKLROOT}" DIRECTORY)
endif()
endif()
set(BLAS_mkl_LIB_PATH_SUFFIXES
"compiler/lib" "compiler/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}"
"mkl/lib" "mkl/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}"
"lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}")
foreach(IT ${BLAS_SEARCH_LIBS})
string(REPLACE " " ";" SEARCH_LIBS ${IT})
if(NOT ${_LIBRARIES})
check_blas_libraries(
${_LIBRARIES}
BLAS
${BLAS_mkl_SEARCH_SYMBOL}
""
"${SEARCH_LIBS}"
"${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
"${BLAS_mkl_MKLROOT}"
"${BLAS_mkl_LIB_PATH_SUFFIXES}"
)
endif()
endforeach()
unset(BLAS_mkl_ILP_MODE)
unset(BLAS_mkl_INTFACE)
unset(BLAS_mkl_THREADING)
unset(BLAS_mkl_OMP)
unset(BLAS_mkl_DLL_SUFFIX)
unset(BLAS_mkl_LM)
unset(BLAS_mkl_LDL)
unset(BLAS_mkl_MKLROOT)
unset(BLAS_mkl_MKLROOT_LAST_DIR)
unset(BLAS_mkl_ARCH_NAME)
unset(BLAS_mkl_OS_NAME)
unset(BLAS_mkl_LIB_PATH_SUFFIXES)
endif()
find_package_handle_standard_args(MKL REQUIRED_VARS BLAS_LIBRARIES)
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+7
View File
@@ -0,0 +1,7 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
include("${CMAKE_CURRENT_LIST_DIR}/faiss-targets.cmake")
Vendored
-7998
View File
File diff suppressed because it is too large Load Diff
-70
View File
@@ -1,70 +0,0 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([faiss], [1.0])
AC_COPYRIGHT([Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.])
AC_CONFIG_SRCDIR([faiss/Index.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([acinclude])
: ${CXXFLAGS="-g -O3 -Wall -Wextra"}
# Checks for programs.
AC_LANG(C++)
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
FA_PYTHON
if test x$PYTHON != x; then
FA_NUMPY
fi
FA_PROG_SWIG
FA_CHECK_CUDA
# Checks for header files.
AC_CHECK_HEADERS([float.h limits.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_C_RESTRICT
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_CHECK_FUNCS([clock_gettime floor gettimeofday memmove memset munmap pow sqrt strerror strstr])
AC_OPENMP
AX_BLAS
if test "x$ax_blas_ok" == "xno"; then
AC_MSG_ERROR([An implementation of BLAS is required but none was found.])
fi
AX_LAPACK
if test "x$ax_lapack_ok" == "xno"; then
AC_MSG_ERROR([An implementation of LAPACK is required but none was found.])
fi
AX_CPU_ARCH
AC_CONFIG_FILES([makefile.inc])
AC_OUTPUT
+20
View File
@@ -0,0 +1,20 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
add_executable(demo_imi_flat EXCLUDE_FROM_ALL demo_imi_flat.cpp)
target_link_libraries(demo_imi_flat PRIVATE faiss)
add_executable(demo_imi_pq EXCLUDE_FROM_ALL demo_imi_pq.cpp)
target_link_libraries(demo_imi_pq PRIVATE faiss)
add_executable(demo_ivfpq_indexing EXCLUDE_FROM_ALL demo_ivfpq_indexing.cpp)
target_link_libraries(demo_ivfpq_indexing PRIVATE faiss)
add_executable(demo_sift1M EXCLUDE_FROM_ALL demo_sift1M.cpp)
target_link_libraries(demo_sift1M PRIVATE faiss)
add_executable(demo_weighted_kmeans EXCLUDE_FROM_ALL demo_weighted_kmeans.cpp)
target_link_libraries(demo_weighted_kmeans PRIVATE faiss)
-21
View File
@@ -1,21 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
-include ../makefile.inc
DEMOS_SRC=$(wildcard demo_*.cpp)
DEMOS=$(DEMOS_SRC:.cpp=)
all: $(DEMOS)
clean:
rm -f $(DEMOS)
%: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) -lfaiss
.PHONY: all clean
-509
View File
@@ -1,509 +0,0 @@
AutoTune.o: AutoTune.cpp faiss/AutoTune.h faiss/Index.h \
faiss/MetricType.h faiss/IndexBinary.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/utils/utils.h faiss/utils/Heap.h \
faiss/utils/random.h faiss/IndexFlat.h faiss/VectorTransform.h \
faiss/IndexPreTransform.h faiss/IndexLSH.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/Clustering.h \
faiss/impl/ProductQuantizer-inl.h faiss/impl/PolysemousTraining.h \
faiss/IndexIVF.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/IndexIVFPQ.h faiss/IndexIVFPQR.h faiss/IndexIVFFlat.h \
faiss/MetaIndexes.h faiss/IndexShards.h faiss/impl/ThreadedIndex.h \
faiss/utils/WorkerThread.h faiss/impl/ThreadedIndex-inl.h \
faiss/IndexReplicas.h faiss/IndexScalarQuantizer.h \
faiss/impl/ScalarQuantizer.h faiss/impl/AuxIndexStructures.h \
faiss/IndexHNSW.h faiss/impl/HNSW.h faiss/IndexBinaryFlat.h \
faiss/IndexBinaryHNSW.h faiss/IndexBinaryIVF.h
Clustering.o: Clustering.cpp faiss/Clustering.h faiss/Index.h \
faiss/MetricType.h faiss/impl/AuxIndexStructures.h faiss/utils/utils.h \
faiss/utils/Heap.h faiss/utils/random.h faiss/utils/distances.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/IndexFlat.h
DirectMap.o: DirectMap.cpp faiss/DirectMap.h faiss/InvertedLists.h \
faiss/Index.h faiss/MetricType.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/impl/AuxIndexStructures.h
IVFlib.o: IVFlib.cpp faiss/IVFlib.h faiss/IndexIVF.h faiss/Index.h \
faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/IndexPreTransform.h \
faiss/VectorTransform.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/MetaIndexes.h faiss/IndexShards.h \
faiss/IndexBinary.h faiss/impl/ThreadedIndex.h \
faiss/utils/WorkerThread.h faiss/impl/ThreadedIndex-inl.h \
faiss/IndexReplicas.h
Index.o: Index.cpp faiss/Index.h faiss/MetricType.h \
faiss/impl/AuxIndexStructures.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/utils/distances.h faiss/utils/Heap.h
Index2Layer.o: Index2Layer.cpp faiss/Index2Layer.h faiss/IndexPQ.h \
faiss/Index.h faiss/MetricType.h faiss/impl/ProductQuantizer.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/IndexIVFPQ.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/utils/utils.h \
faiss/impl/AuxIndexStructures.h faiss/IndexFlat.h \
faiss/utils/distances.h
IndexBinary.o: IndexBinary.cpp faiss/IndexBinary.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/Index.h \
faiss/MetricType.h
IndexBinaryFlat.o: IndexBinaryFlat.cpp faiss/IndexBinaryFlat.h \
faiss/IndexBinary.h faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/Index.h faiss/MetricType.h faiss/utils/hamming.h \
faiss/utils/Heap.h faiss/utils/hamming-inl.h faiss/utils/utils.h \
faiss/impl/AuxIndexStructures.h
IndexBinaryFromFloat.o: IndexBinaryFromFloat.cpp \
faiss/IndexBinaryFromFloat.h faiss/IndexBinary.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/Index.h \
faiss/MetricType.h faiss/utils/utils.h faiss/utils/Heap.h
IndexBinaryHNSW.o: IndexBinaryHNSW.cpp faiss/IndexBinaryHNSW.h \
faiss/impl/HNSW.h faiss/Index.h faiss/MetricType.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/utils/random.h faiss/utils/Heap.h faiss/IndexBinaryFlat.h \
faiss/IndexBinary.h faiss/utils/utils.h faiss/utils/hamming.h \
faiss/utils/hamming-inl.h faiss/impl/AuxIndexStructures.h
IndexBinaryHash.o: IndexBinaryHash.cpp faiss/IndexBinaryHash.h \
faiss/IndexBinary.h faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/Index.h faiss/MetricType.h faiss/IndexBinaryFlat.h \
faiss/utils/Heap.h faiss/utils/hamming.h faiss/utils/hamming-inl.h \
faiss/utils/utils.h faiss/impl/AuxIndexStructures.h
IndexBinaryIVF.o: IndexBinaryIVF.cpp faiss/IndexBinaryIVF.h \
faiss/IndexBinary.h faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/Index.h faiss/MetricType.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/Clustering.h faiss/utils/Heap.h \
faiss/utils/hamming.h faiss/utils/hamming-inl.h faiss/utils/utils.h \
faiss/impl/AuxIndexStructures.h faiss/IndexFlat.h faiss/IndexLSH.h \
faiss/VectorTransform.h
IndexFlat.o: IndexFlat.cpp faiss/IndexFlat.h faiss/Index.h \
faiss/MetricType.h faiss/utils/distances.h faiss/utils/Heap.h \
faiss/utils/extra_distances.h faiss/utils/utils.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/impl/AuxIndexStructures.h
IndexHNSW.o: IndexHNSW.cpp faiss/IndexHNSW.h faiss/impl/HNSW.h \
faiss/Index.h faiss/MetricType.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/utils/random.h faiss/utils/Heap.h \
faiss/IndexFlat.h faiss/IndexPQ.h faiss/impl/ProductQuantizer.h \
faiss/Clustering.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/IndexScalarQuantizer.h \
faiss/IndexIVF.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/impl/ScalarQuantizer.h faiss/impl/AuxIndexStructures.h \
faiss/utils/utils.h faiss/utils/distances.h faiss/IndexIVFPQ.h \
faiss/Index2Layer.h
IndexIVF.o: IndexIVF.cpp faiss/IndexIVF.h faiss/Index.h \
faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/utils/utils.h \
faiss/utils/hamming.h faiss/utils/hamming-inl.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/IndexFlat.h \
faiss/impl/AuxIndexStructures.h
IndexIVFFlat.o: IndexIVFFlat.cpp faiss/IndexIVFFlat.h faiss/IndexIVF.h \
faiss/Index.h faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/IndexFlat.h \
faiss/utils/distances.h faiss/utils/utils.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/impl/AuxIndexStructures.h
IndexIVFPQ.o: IndexIVFPQ.cpp faiss/IndexIVFPQ.h faiss/IndexIVF.h \
faiss/Index.h faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/utils/utils.h \
faiss/utils/distances.h faiss/IndexFlat.h faiss/utils/hamming.h \
faiss/utils/hamming-inl.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/impl/AuxIndexStructures.h
IndexIVFPQR.o: IndexIVFPQR.cpp faiss/IndexIVFPQR.h faiss/IndexIVFPQ.h \
faiss/IndexIVF.h faiss/Index.h faiss/MetricType.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/Clustering.h faiss/utils/Heap.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/utils/utils.h \
faiss/utils/distances.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h
IndexIVFSpectralHash.o: IndexIVFSpectralHash.cpp \
faiss/IndexIVFSpectralHash.h faiss/IndexIVF.h faiss/Index.h \
faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/utils/hamming.h \
faiss/utils/hamming-inl.h faiss/utils/utils.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/impl/AuxIndexStructures.h \
faiss/VectorTransform.h
IndexLSH.o: IndexLSH.cpp faiss/IndexLSH.h faiss/Index.h \
faiss/MetricType.h faiss/VectorTransform.h faiss/utils/utils.h \
faiss/utils/Heap.h faiss/utils/hamming.h faiss/utils/hamming-inl.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
IndexLattice.o: IndexLattice.cpp faiss/IndexLattice.h faiss/IndexIVF.h \
faiss/Index.h faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/impl/lattice_Zn.h \
faiss/utils/hamming.h faiss/utils/hamming-inl.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/utils/distances.h
IndexPQ.o: IndexPQ.cpp faiss/IndexPQ.h faiss/Index.h faiss/MetricType.h \
faiss/impl/ProductQuantizer.h faiss/Clustering.h faiss/utils/Heap.h \
faiss/impl/ProductQuantizer-inl.h faiss/impl/PolysemousTraining.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/impl/AuxIndexStructures.h faiss/utils/hamming.h \
faiss/utils/hamming-inl.h
IndexPreTransform.o: IndexPreTransform.cpp faiss/IndexPreTransform.h \
faiss/Index.h faiss/MetricType.h faiss/VectorTransform.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
IndexReplicas.o: IndexReplicas.cpp faiss/IndexReplicas.h faiss/Index.h \
faiss/MetricType.h faiss/IndexBinary.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/impl/ThreadedIndex.h \
faiss/utils/WorkerThread.h faiss/impl/ThreadedIndex-inl.h
IndexScalarQuantizer.o: IndexScalarQuantizer.cpp \
faiss/IndexScalarQuantizer.h faiss/IndexIVF.h faiss/Index.h \
faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/impl/ScalarQuantizer.h \
faiss/impl/AuxIndexStructures.h faiss/utils/utils.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
IndexShards.o: IndexShards.cpp faiss/IndexShards.h faiss/Index.h \
faiss/MetricType.h faiss/IndexBinary.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/impl/ThreadedIndex.h \
faiss/utils/WorkerThread.h faiss/impl/ThreadedIndex-inl.h \
faiss/utils/Heap.h
InvertedLists.o: InvertedLists.cpp faiss/InvertedLists.h faiss/Index.h \
faiss/MetricType.h faiss/utils/utils.h faiss/utils/Heap.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
MatrixStats.o: MatrixStats.cpp faiss/MatrixStats.h faiss/utils/utils.h \
faiss/utils/Heap.h
MetaIndexes.o: MetaIndexes.cpp faiss/MetaIndexes.h faiss/Index.h \
faiss/MetricType.h faiss/IndexShards.h faiss/IndexBinary.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/impl/ThreadedIndex.h faiss/utils/WorkerThread.h \
faiss/impl/ThreadedIndex-inl.h faiss/IndexReplicas.h faiss/utils/Heap.h \
faiss/impl/AuxIndexStructures.h
OnDiskInvertedLists.o: OnDiskInvertedLists.cpp \
faiss/OnDiskInvertedLists.h faiss/IndexIVF.h faiss/Index.h \
faiss/MetricType.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/index_io.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/utils/utils.h \
faiss/impl/io.h faiss/impl/io_macros.h
VectorTransform.o: VectorTransform.cpp faiss/VectorTransform.h \
faiss/Index.h faiss/MetricType.h faiss/utils/distances.h \
faiss/utils/Heap.h faiss/utils/random.h faiss/utils/utils.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/Clustering.h \
faiss/impl/ProductQuantizer-inl.h faiss/impl/PolysemousTraining.h
clone_index.o: clone_index.cpp faiss/clone_index.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/IndexFlat.h \
faiss/Index.h faiss/MetricType.h faiss/VectorTransform.h \
faiss/IndexPreTransform.h faiss/IndexLSH.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/Clustering.h faiss/utils/Heap.h \
faiss/impl/ProductQuantizer-inl.h faiss/impl/PolysemousTraining.h \
faiss/IndexIVF.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/IndexIVFPQ.h faiss/IndexIVFPQR.h faiss/Index2Layer.h \
faiss/IndexIVFFlat.h faiss/IndexIVFSpectralHash.h faiss/MetaIndexes.h \
faiss/IndexShards.h faiss/IndexBinary.h faiss/impl/ThreadedIndex.h \
faiss/utils/WorkerThread.h faiss/impl/ThreadedIndex-inl.h \
faiss/IndexReplicas.h faiss/IndexScalarQuantizer.h \
faiss/impl/ScalarQuantizer.h faiss/impl/AuxIndexStructures.h \
faiss/IndexHNSW.h faiss/impl/HNSW.h faiss/utils/random.h \
faiss/utils/utils.h faiss/IndexLattice.h faiss/impl/lattice_Zn.h
index_factory.o: index_factory.cpp faiss/AutoTune.h faiss/Index.h \
faiss/MetricType.h faiss/IndexBinary.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/utils/utils.h faiss/utils/Heap.h \
faiss/utils/random.h faiss/IndexFlat.h faiss/VectorTransform.h \
faiss/IndexPreTransform.h faiss/IndexLSH.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/Clustering.h \
faiss/impl/ProductQuantizer-inl.h faiss/impl/PolysemousTraining.h \
faiss/IndexIVF.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/IndexIVFPQ.h faiss/IndexIVFPQR.h faiss/Index2Layer.h \
faiss/IndexIVFFlat.h faiss/MetaIndexes.h faiss/IndexShards.h \
faiss/impl/ThreadedIndex.h faiss/utils/WorkerThread.h \
faiss/impl/ThreadedIndex-inl.h faiss/IndexReplicas.h \
faiss/IndexScalarQuantizer.h faiss/impl/ScalarQuantizer.h \
faiss/impl/AuxIndexStructures.h faiss/IndexHNSW.h faiss/impl/HNSW.h \
faiss/IndexLattice.h faiss/impl/lattice_Zn.h faiss/IndexBinaryFlat.h \
faiss/IndexBinaryHNSW.h faiss/IndexBinaryIVF.h faiss/IndexBinaryHash.h
AuxIndexStructures.o: impl/AuxIndexStructures.cpp \
faiss/impl/AuxIndexStructures.h faiss/Index.h faiss/MetricType.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
FaissException.o: impl/FaissException.cpp faiss/impl/FaissException.h
HNSW.o: impl/HNSW.cpp faiss/impl/HNSW.h faiss/Index.h faiss/MetricType.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/utils/random.h faiss/utils/Heap.h faiss/impl/AuxIndexStructures.h
PolysemousTraining.o: impl/PolysemousTraining.cpp \
faiss/impl/PolysemousTraining.h faiss/impl/ProductQuantizer.h \
faiss/Clustering.h faiss/Index.h faiss/MetricType.h faiss/utils/Heap.h \
faiss/impl/ProductQuantizer-inl.h faiss/utils/random.h \
faiss/utils/utils.h faiss/utils/distances.h faiss/utils/hamming.h \
faiss/utils/hamming-inl.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h
ProductQuantizer.o: impl/ProductQuantizer.cpp \
faiss/impl/ProductQuantizer.h faiss/Clustering.h faiss/Index.h \
faiss/MetricType.h faiss/utils/Heap.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/VectorTransform.h faiss/IndexFlat.h faiss/utils/distances.h
ScalarQuantizer.o: impl/ScalarQuantizer.cpp faiss/impl/ScalarQuantizer.h \
faiss/IndexIVF.h faiss/Index.h faiss/MetricType.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/Clustering.h faiss/utils/Heap.h \
faiss/impl/AuxIndexStructures.h faiss/utils/utils.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
index_read.o: impl/index_read.cpp faiss/index_io.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/impl/io.h \
faiss/Index.h faiss/MetricType.h faiss/impl/io_macros.h \
faiss/utils/hamming.h faiss/utils/Heap.h faiss/utils/hamming-inl.h \
faiss/IndexFlat.h faiss/VectorTransform.h faiss/IndexPreTransform.h \
faiss/IndexLSH.h faiss/IndexPQ.h faiss/impl/ProductQuantizer.h \
faiss/Clustering.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/IndexIVFPQ.h faiss/IndexIVFPQR.h \
faiss/Index2Layer.h faiss/IndexIVFFlat.h faiss/IndexIVFSpectralHash.h \
faiss/MetaIndexes.h faiss/IndexShards.h faiss/IndexBinary.h \
faiss/impl/ThreadedIndex.h faiss/utils/WorkerThread.h \
faiss/impl/ThreadedIndex-inl.h faiss/IndexReplicas.h \
faiss/IndexScalarQuantizer.h faiss/impl/ScalarQuantizer.h \
faiss/impl/AuxIndexStructures.h faiss/IndexHNSW.h faiss/impl/HNSW.h \
faiss/utils/random.h faiss/utils/utils.h faiss/IndexLattice.h \
faiss/impl/lattice_Zn.h faiss/OnDiskInvertedLists.h \
faiss/IndexBinaryFlat.h faiss/IndexBinaryFromFloat.h \
faiss/IndexBinaryHNSW.h faiss/IndexBinaryIVF.h faiss/IndexBinaryHash.h
index_write.o: impl/index_write.cpp faiss/index_io.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h faiss/impl/io.h \
faiss/Index.h faiss/MetricType.h faiss/impl/io_macros.h \
faiss/utils/hamming.h faiss/utils/Heap.h faiss/utils/hamming-inl.h \
faiss/IndexFlat.h faiss/VectorTransform.h faiss/IndexPreTransform.h \
faiss/IndexLSH.h faiss/IndexPQ.h faiss/impl/ProductQuantizer.h \
faiss/Clustering.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/IndexIVFPQ.h faiss/IndexIVFPQR.h \
faiss/Index2Layer.h faiss/IndexIVFFlat.h faiss/IndexIVFSpectralHash.h \
faiss/MetaIndexes.h faiss/IndexShards.h faiss/IndexBinary.h \
faiss/impl/ThreadedIndex.h faiss/utils/WorkerThread.h \
faiss/impl/ThreadedIndex-inl.h faiss/IndexReplicas.h \
faiss/IndexScalarQuantizer.h faiss/impl/ScalarQuantizer.h \
faiss/impl/AuxIndexStructures.h faiss/IndexHNSW.h faiss/impl/HNSW.h \
faiss/utils/random.h faiss/utils/utils.h faiss/IndexLattice.h \
faiss/impl/lattice_Zn.h faiss/OnDiskInvertedLists.h \
faiss/IndexBinaryFlat.h faiss/IndexBinaryFromFloat.h \
faiss/IndexBinaryHNSW.h faiss/IndexBinaryIVF.h faiss/IndexBinaryHash.h
io.o: impl/io.cpp faiss/impl/io.h faiss/Index.h faiss/MetricType.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
lattice_Zn.o: impl/lattice_Zn.cpp faiss/impl/lattice_Zn.h \
faiss/utils/distances.h faiss/utils/Heap.h
Heap.o: utils/Heap.cpp faiss/utils/Heap.h
WorkerThread.o: utils/WorkerThread.cpp faiss/utils/WorkerThread.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
distances.o: utils/distances.cpp faiss/utils/distances.h \
faiss/utils/Heap.h faiss/impl/AuxIndexStructures.h faiss/Index.h \
faiss/MetricType.h faiss/impl/FaissAssert.h faiss/impl/FaissException.h
distances_simd.o: utils/distances_simd.cpp faiss/utils/distances.h \
faiss/utils/Heap.h
extra_distances.o: utils/extra_distances.cpp faiss/utils/distances.h \
faiss/utils/Heap.h faiss/utils/utils.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/impl/AuxIndexStructures.h \
faiss/Index.h faiss/MetricType.h
hamming.o: utils/hamming.cpp faiss/utils/hamming.h faiss/utils/Heap.h \
faiss/utils/hamming-inl.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/utils/utils.h \
faiss/impl/AuxIndexStructures.h faiss/Index.h faiss/MetricType.h
random.o: utils/random.cpp faiss/utils/random.h
utils.o: utils/utils.cpp faiss/utils/utils.h faiss/utils/Heap.h \
faiss/impl/AuxIndexStructures.h faiss/Index.h faiss/MetricType.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/utils/random.h
GpuAutoTune.o: gpu/GpuAutoTune.cpp faiss/gpu/GpuAutoTune.h faiss/Index.h \
faiss/MetricType.h faiss/AutoTune.h faiss/IndexBinary.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/gpu/GpuIndex.h faiss/gpu/GpuResources.h faiss/IndexReplicas.h \
faiss/impl/ThreadedIndex.h faiss/utils/WorkerThread.h \
faiss/impl/ThreadedIndex-inl.h faiss/IndexShards.h \
faiss/IndexPreTransform.h faiss/VectorTransform.h \
faiss/gpu/GpuIndexFlat.h faiss/gpu/GpuIndexIVFFlat.h \
faiss/gpu/GpuIndexIVF.h faiss/gpu/GpuIndicesOptions.h faiss/Clustering.h \
faiss/gpu/GpuIndexIVFPQ.h faiss/gpu/GpuIndexIVFScalarQuantizer.h \
faiss/IndexScalarQuantizer.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/utils/Heap.h faiss/impl/ScalarQuantizer.h \
faiss/impl/AuxIndexStructures.h faiss/gpu/utils/DeviceUtils.h
GpuCloner.o: gpu/GpuCloner.cpp faiss/gpu/GpuCloner.h faiss/Index.h \
faiss/MetricType.h faiss/clone_index.h faiss/gpu/GpuClonerOptions.h \
faiss/gpu/GpuIndicesOptions.h faiss/gpu/GpuIndex.h \
faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/index_io.h faiss/IndexFlat.h \
faiss/IndexIVF.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/Clustering.h faiss/utils/Heap.h faiss/IndexIVFFlat.h \
faiss/IndexScalarQuantizer.h faiss/impl/ScalarQuantizer.h \
faiss/impl/AuxIndexStructures.h faiss/IndexIVFPQ.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/IndexReplicas.h \
faiss/IndexBinary.h faiss/impl/ThreadedIndex.h \
faiss/utils/WorkerThread.h faiss/impl/ThreadedIndex-inl.h \
faiss/IndexPreTransform.h faiss/VectorTransform.h faiss/MetaIndexes.h \
faiss/IndexShards.h faiss/gpu/GpuIndexFlat.h faiss/gpu/GpuIndexIVFFlat.h \
faiss/gpu/GpuIndexIVF.h faiss/gpu/GpuIndexIVFPQ.h \
faiss/gpu/GpuIndexIVFScalarQuantizer.h faiss/gpu/utils/DeviceUtils.h
GpuClonerOptions.o: gpu/GpuClonerOptions.cpp faiss/gpu/GpuClonerOptions.h \
faiss/gpu/GpuIndicesOptions.h
GpuResources.o: gpu/GpuResources.cpp faiss/gpu/GpuResources.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/gpu/utils/DeviceUtils.h
StandardGpuResources.o: gpu/StandardGpuResources.cpp \
faiss/gpu/StandardGpuResources.h faiss/gpu/GpuResources.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/gpu/utils/StackDeviceMemory.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/utils/StaticUtils.h
RemapIndices.o: gpu/impl/RemapIndices.cpp faiss/gpu/impl/RemapIndices.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
DeviceMemory.o: gpu/utils/DeviceMemory.cpp faiss/gpu/utils/DeviceMemory.h \
faiss/gpu/utils/DeviceUtils.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h
MemorySpace.o: gpu/utils/MemorySpace.cpp faiss/gpu/utils/MemorySpace.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h
StackDeviceMemory.o: gpu/utils/StackDeviceMemory.cpp \
faiss/gpu/utils/StackDeviceMemory.h faiss/gpu/GpuResources.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/StaticUtils.h
Timer.o: gpu/utils/Timer.cpp faiss/gpu/utils/Timer.h \
faiss/gpu/utils/DeviceUtils.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h
GpuIndex.o: gpu/GpuIndex.cu faiss/gpu/GpuIndex.h faiss/Index.h \
faiss/MetricType.h faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/utils/CopyUtils.cuh \
faiss/gpu/utils/DeviceTensor.cuh faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/utils/HostTensor.cuh faiss/gpu/utils/HostTensor-inl.cuh \
faiss/gpu/utils/StaticUtils.h
GpuIndexBinaryFlat.o: gpu/GpuIndexBinaryFlat.cu \
faiss/gpu/GpuIndexBinaryFlat.h faiss/IndexBinaryFlat.h \
faiss/IndexBinary.h faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/Index.h faiss/MetricType.h faiss/gpu/GpuIndex.h \
faiss/gpu/GpuResources.h faiss/gpu/impl/BinaryFlatIndex.cuh \
faiss/gpu/utils/DeviceTensor.cuh faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/utils/DeviceVector.cuh faiss/gpu/utils/StaticUtils.h \
faiss/gpu/utils/ConversionOperators.cuh faiss/gpu/utils/Float16.cuh \
faiss/gpu/utils/CopyUtils.cuh faiss/gpu/utils/HostTensor.cuh \
faiss/gpu/utils/HostTensor-inl.cuh
GpuIndexFlat.o: gpu/GpuIndexFlat.cu faiss/gpu/GpuIndexFlat.h \
faiss/gpu/GpuIndex.h faiss/Index.h faiss/MetricType.h \
faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/IndexFlat.h \
faiss/gpu/impl/FlatIndex.cuh faiss/gpu/utils/DeviceTensor.cuh \
faiss/gpu/utils/Tensor.cuh faiss/gpu/utils/Tensor-inl.cuh \
faiss/gpu/GpuFaissAssert.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/utils/DeviceTensor-inl.cuh faiss/gpu/utils/DeviceVector.cuh \
faiss/gpu/utils/StaticUtils.h faiss/gpu/utils/ConversionOperators.cuh \
faiss/gpu/utils/Float16.cuh faiss/gpu/utils/CopyUtils.cuh \
faiss/gpu/utils/HostTensor.cuh faiss/gpu/utils/HostTensor-inl.cuh
GpuIndexIVF.o: gpu/GpuIndexIVF.cu faiss/gpu/GpuIndexIVF.h \
faiss/gpu/GpuIndex.h faiss/Index.h faiss/MetricType.h \
faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/GpuIndexFlat.h \
faiss/gpu/GpuIndicesOptions.h faiss/Clustering.h faiss/IndexFlat.h \
faiss/IndexIVF.h faiss/InvertedLists.h faiss/DirectMap.h \
faiss/utils/Heap.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/utils/Float16.cuh faiss/gpu/utils/DeviceTensor.cuh \
faiss/gpu/utils/Tensor.cuh faiss/gpu/utils/Tensor-inl.cuh \
faiss/gpu/GpuFaissAssert.h faiss/gpu/utils/DeviceTensor-inl.cuh
GpuIndexIVFFlat.o: gpu/GpuIndexIVFFlat.cu faiss/gpu/GpuIndexIVFFlat.h \
faiss/gpu/GpuIndexIVF.h faiss/gpu/GpuIndex.h faiss/Index.h \
faiss/MetricType.h faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/GpuIndexFlat.h \
faiss/gpu/GpuIndicesOptions.h faiss/Clustering.h faiss/IndexFlat.h \
faiss/IndexIVFFlat.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/utils/Heap.h faiss/gpu/impl/IVFFlat.cuh \
faiss/gpu/impl/IVFBase.cuh faiss/gpu/utils/DeviceVector.cuh \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/StaticUtils.h \
faiss/gpu/utils/DeviceTensor.cuh faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/impl/GpuScalarQuantizer.cuh faiss/IndexScalarQuantizer.h \
faiss/impl/ScalarQuantizer.h faiss/impl/AuxIndexStructures.h \
faiss/gpu/utils/ConversionOperators.cuh faiss/gpu/utils/Float16.cuh \
faiss/gpu/utils/HostTensor.cuh faiss/gpu/utils/HostTensor-inl.cuh \
faiss/gpu/utils/CopyUtils.cuh
GpuIndexIVFPQ.o: gpu/GpuIndexIVFPQ.cu faiss/gpu/GpuIndexIVFPQ.h \
faiss/gpu/GpuIndexIVF.h faiss/gpu/GpuIndex.h faiss/Index.h \
faiss/MetricType.h faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/GpuIndexFlat.h \
faiss/gpu/GpuIndicesOptions.h faiss/Clustering.h faiss/IndexFlat.h \
faiss/IndexIVFPQ.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/utils/Heap.h faiss/IndexPQ.h \
faiss/impl/ProductQuantizer.h faiss/impl/ProductQuantizer-inl.h \
faiss/impl/PolysemousTraining.h faiss/gpu/impl/IVFPQ.cuh \
faiss/gpu/impl/IVFBase.cuh faiss/gpu/utils/DeviceVector.cuh \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/StaticUtils.h \
faiss/gpu/utils/DeviceTensor.cuh faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/gpu/utils/DeviceTensor-inl.cuh faiss/gpu/utils/Float16.cuh \
faiss/gpu/utils/CopyUtils.cuh faiss/gpu/utils/HostTensor.cuh \
faiss/gpu/utils/HostTensor-inl.cuh
GpuIndexIVFScalarQuantizer.o: gpu/GpuIndexIVFScalarQuantizer.cu \
faiss/gpu/GpuIndexIVFScalarQuantizer.h faiss/gpu/GpuIndexIVF.h \
faiss/gpu/GpuIndex.h faiss/Index.h faiss/MetricType.h \
faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/GpuIndexFlat.h \
faiss/gpu/GpuIndicesOptions.h faiss/Clustering.h \
faiss/IndexScalarQuantizer.h faiss/IndexIVF.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/utils/Heap.h faiss/impl/ScalarQuantizer.h \
faiss/impl/AuxIndexStructures.h faiss/gpu/impl/GpuScalarQuantizer.cuh \
faiss/gpu/utils/ConversionOperators.cuh faiss/gpu/utils/DeviceTensor.cuh \
faiss/gpu/utils/Tensor.cuh faiss/gpu/utils/Tensor-inl.cuh \
faiss/gpu/GpuFaissAssert.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/utils/DeviceTensor-inl.cuh faiss/gpu/utils/Float16.cuh \
faiss/gpu/utils/HostTensor.cuh faiss/gpu/utils/HostTensor-inl.cuh \
faiss/gpu/impl/IVFFlat.cuh faiss/gpu/impl/IVFBase.cuh \
faiss/gpu/utils/DeviceVector.cuh faiss/gpu/utils/StaticUtils.h \
faiss/gpu/utils/CopyUtils.cuh
BinaryFlatIndex.o: gpu/impl/BinaryFlatIndex.cu \
faiss/gpu/impl/BinaryFlatIndex.cuh faiss/gpu/utils/DeviceTensor.cuh \
faiss/gpu/utils/Tensor.cuh faiss/gpu/utils/Tensor-inl.cuh \
faiss/gpu/GpuFaissAssert.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/GpuResources.h faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/utils/DeviceVector.cuh faiss/gpu/utils/StaticUtils.h \
faiss/gpu/impl/BinaryDistance.cuh
BroadcastSum.o: gpu/impl/BroadcastSum.cu faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/utils/MathOperators.cuh \
faiss/gpu/utils/ConversionOperators.cuh faiss/MetricType.h \
faiss/gpu/utils/DeviceTensor.cuh faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/gpu/GpuResources.h faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/utils/Float16.cuh faiss/gpu/utils/StaticUtils.h
IVFAppend.o: gpu/impl/IVFAppend.cu faiss/gpu/impl/IVFAppend.cuh \
faiss/gpu/impl/GpuScalarQuantizer.cuh faiss/IndexScalarQuantizer.h \
faiss/IndexIVF.h faiss/Index.h faiss/MetricType.h faiss/InvertedLists.h \
faiss/DirectMap.h faiss/Clustering.h faiss/utils/Heap.h \
faiss/impl/ScalarQuantizer.h faiss/impl/AuxIndexStructures.h \
faiss/gpu/utils/ConversionOperators.cuh faiss/gpu/utils/DeviceTensor.cuh \
faiss/gpu/utils/Tensor.cuh faiss/gpu/utils/Tensor-inl.cuh \
faiss/gpu/GpuFaissAssert.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/GpuResources.h faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/utils/Float16.cuh faiss/gpu/utils/HostTensor.cuh \
faiss/gpu/utils/HostTensor-inl.cuh faiss/gpu/GpuIndicesOptions.h \
faiss/gpu/utils/StaticUtils.h
IVFUtils.o: gpu/impl/IVFUtils.cu faiss/gpu/impl/IVFUtils.cuh \
faiss/gpu/GpuIndicesOptions.h faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/StaticUtils.h \
faiss/gpu/utils/ThrustAllocator.cuh faiss/gpu/GpuResources.h
PQScanMultiPassPrecomputed.o: gpu/impl/PQScanMultiPassPrecomputed.cu \
faiss/gpu/impl/PQScanMultiPassPrecomputed.cuh \
faiss/gpu/GpuIndicesOptions.h faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/NoTypeTensor.cuh \
faiss/gpu/GpuResources.h faiss/gpu/impl/PQCodeLoad.cuh \
faiss/gpu/utils/PtxUtils.cuh faiss/gpu/impl/IVFUtils.cuh \
faiss/gpu/utils/ConversionOperators.cuh faiss/MetricType.h \
faiss/gpu/utils/DeviceTensor.cuh faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/utils/Float16.cuh faiss/gpu/utils/LoadStoreOperators.cuh \
faiss/gpu/utils/MathOperators.cuh faiss/gpu/utils/StaticUtils.h
VectorResidual.o: gpu/impl/VectorResidual.cu \
faiss/gpu/impl/VectorResidual.cuh faiss/gpu/utils/Tensor.cuh \
faiss/gpu/utils/Tensor-inl.cuh faiss/gpu/GpuFaissAssert.h \
faiss/impl/FaissAssert.h faiss/impl/FaissException.h \
faiss/gpu/utils/DeviceUtils.h faiss/gpu/utils/ConversionOperators.cuh \
faiss/MetricType.h faiss/gpu/utils/DeviceTensor.cuh \
faiss/gpu/GpuResources.h faiss/gpu/utils/DeviceTensor-inl.cuh \
faiss/gpu/utils/Float16.cuh faiss/gpu/utils/StaticUtils.h
Float16.o: gpu/utils/Float16.cu faiss/gpu/utils/Float16.cuh \
faiss/gpu/GpuResources.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/utils/DeviceTensor.cuh \
faiss/gpu/utils/Tensor.cuh faiss/gpu/utils/Tensor-inl.cuh \
faiss/gpu/GpuFaissAssert.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/utils/DeviceTensor-inl.cuh faiss/gpu/utils/nvidia/fp16_emu.cuh
MatrixMult.o: gpu/utils/MatrixMult.cu faiss/gpu/utils/MatrixMult.cuh \
faiss/gpu/utils/Tensor.cuh faiss/gpu/utils/Tensor-inl.cuh \
faiss/gpu/GpuFaissAssert.h faiss/impl/FaissAssert.h \
faiss/impl/FaissException.h faiss/gpu/utils/DeviceUtils.h \
faiss/gpu/utils/DeviceTensor.cuh faiss/gpu/GpuResources.h \
faiss/gpu/utils/DeviceTensor-inl.cuh faiss/gpu/utils/HostTensor.cuh \
faiss/gpu/utils/HostTensor-inl.cuh faiss/gpu/utils/Float16.cuh \
faiss/gpu/utils/MatrixMult-inl.cuh
fp16_emu.o: gpu/utils/nvidia/fp16_emu.cu \
faiss/gpu/utils/nvidia/fp16_emu.cuh
-140
View File
@@ -1,140 +0,0 @@
# -*- makefile -*-
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# tested on CentOS 7, Ubuntu 16 and Ubuntu 14, see below to adjust flags to distribution.
CXX = g++ -std=c++11
CXXFLAGS = -fPIC -m64 -Wall -g -O3 -fopenmp -Wno-sign-compare
CPUFLAGS = -mavx -msse4 -mpopcnt
LDFLAGS = -fPIC -fopenmp
# common linux flags
SHAREDEXT = so
SHAREDFLAGS = -shared
MKDIR_P = mkdir -p
prefix ?= /usr/local
exec_prefix ?= ${prefix}
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
##########################################################################
# Uncomment one of the 4 BLAS/Lapack implementation options
# below. They are sorted # from fastest to slowest (in our
# experiments).
##########################################################################
#
# 1. Intel MKL
#
# This is the fastest BLAS implementation we tested. Unfortunately it
# is not open-source and determining the correct linking flags is a
# nightmare. See
#
# https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
#
# The latest tested version is MKL 2017.0.098 (2017 Initial Release) and can
# be downloaded here:
#
# https://registrationcenter.intel.com/en/forms/?productid=2558&licensetype=2
#
# The following settings are working if MKL is installed on its default folder:
#
# MKLROOT = /opt/intel/compilers_and_libraries/linux/mkl/
#
# LDFLAGS += -Wl,--no-as-needed -L$(MKLROOT)/lib/intel64
# LIBS += -lmkl_intel_ilp64 -lmkl_core -lmkl_gnu_thread -ldl -lpthread
#
# CPPFLAGS += -DFINTEGER=long
#
# You may have to set the LD_LIBRARY_PATH=$MKLROOT/lib/intel64 at runtime.
#
# If at runtime you get the error:
# Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so
# you may set
# LD_PRELOAD=$MKLROOT/lib/intel64/libmkl_core.so:$MKLROOT/lib/intel64/libmkl_sequential.so
# at runtime as well.
#
# 2. Openblas
#
# The library contains both BLAS and Lapack. About 30% slower than MKL. Please see
# https://github.com/facebookresearch/faiss/wiki/Troubleshooting#slow-brute-force-search-with-openblas
# to fix performance problemes with OpenBLAS
# for Ubuntu 16:
# sudo apt-get install libopenblas-dev python-numpy python-dev
# for Ubuntu 14:
# sudo apt-get install libopenblas-dev liblapack3 python-numpy python-dev
CPPFLAGS += -DFINTEGER=int
LIBS += -lopenblas -llapack
# 3. Atlas
#
# Automatically tuned linear algebra package. As the name indicates,
# it is tuned automatically for a give architecture, and in Linux
# distributions, it the architecture is typically indicated by the
# directory name, eg. atlas-sse3 = optimized for SSE3 architecture.
#
# BLASCFLAGS=-DFINTEGER=int
# BLASLDFLAGS=/usr/lib64/atlas-sse3/libptf77blas.so.3 /usr/lib64/atlas-sse3/liblapack.so
#
# 4. reference implementation
#
# This is just a compiled version of the reference BLAS
# implementation, that is not optimized at all.
#
# CPPFLAGS += -DFINTEGER=int
# LIBS += /usr/lib64/libblas.so.3 /usr/lib64/liblapack.so.3.2
#
##########################################################################
# SWIG and Python flags
##########################################################################
# SWIG executable. This should be at least version 3.x
SWIG = swig
# The Python include directories for a given python executable can
# typically be found with
#
# python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc()"
# python -c "import numpy ; print numpy.get_include()"
#
# or, for Python 3, with
#
# python3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())"
# python3 -c "import numpy ; print(numpy.get_include())"
#
PYTHONCFLAGS = -I/usr/include/python2.7/ -I/usr/lib64/python2.7/site-packages/numpy/core/include/
PYTHONLIB = -lpython
PYTHON = /usr/bin/python
###########################################################################
# Cuda GPU flags
###########################################################################
# root of the cuda 8 installation
CUDAROOT = /usr/local/cuda-8.0
NVCC = $(CUDAROOT)/bin/nvcc
NVCCLDFLAGS = -L$(CUDAROOT)/lib64
NVCCLIBS = -lcudart -lcublas -lcuda
CUDACFLAGS = -I$(CUDAROOT)/include
NVCCFLAGS = -I $(CUDAROOT)/targets/x86_64-linux/include/ \
-Xcompiler -fPIC \
-Xcudafe --diag_suppress=unrecognized_attribute \
-gencode arch=compute_35,code="compute_35" \
-gencode arch=compute_52,code="compute_52" \
-gencode arch=compute_60,code="compute_60" \
-lineinfo \
-ccbin $(CXX) -DFAISS_USE_FLOAT16
-99
View File
@@ -1,99 +0,0 @@
# -*- makefile -*-
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Tested on macOS Sierra (10.12.2) with llvm installed using Homebrew (https://brew.sh)
# brew install llvm
CXX = /usr/local/opt/llvm/bin/clang++ -std=c++11
CXXFLAGS = -fPIC -m64 -Wall -g -O3 -fopenmp -Wno-sign-compare -I/usr/local/opt/llvm/include
CPUFLAGS = -msse4 -mpopcnt
LLVM_VERSION_PATH=$(shell ls -rt /usr/local/Cellar/llvm/ | tail -n1)
LDFLAGS = -fPIC -fopenmp -L/usr/local/opt/llvm/lib -L/usr/local/Cellar/llvm/${LLVM_VERSION_PATH}/lib
# common mac flags
SHAREDEXT = dylib
SHAREDFLAGS = -dynamiclib
MKDIR_P = mkdir -p
prefix ?= /usr/local
exec_prefix ?= ${prefix}
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
##########################################################################
# Uncomment one of the 4 BLAS/Lapack implementation options
# below. They are sorted # from fastest to slowest (in our
# experiments).
##########################################################################
#
# 1. Intel MKL
#
# This is the fastest BLAS implementation we tested. Unfortunately it
# is not open-source and determining the correct linking flags is a
# nightmare. See
#
# https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
#
# The latest tested version is MKL 2017.0.098 (2017 Initial Release) and can
# be downloaded here:
#
# https://registrationcenter.intel.com/en/forms/?productid=2558&licensetype=2
#
# The following settings are working if MKL is installed on its default folder:
#
# MKLROOT = /opt/intel/compilers_and_libraries/linux/mkl/
#
# LDFLAGS += -Wl,--no-as-needed -L$(MKLROOT)/lib/intel64
# LIBS += -lmkl_intel_ilp64 -lmkl_core -lmkl_gnu_thread -ldl -lpthread
#
# CPPFLAGS += -DFINTEGER=long
#
# You may have to set the LD_LIBRARY_PATH=$MKLROOT/lib/intel64 at runtime.
#
# 2. Openblas
#
# The library contains both BLAS and Lapack. Install with brew install OpenBLAS
#
# CPPFLAGS += -DFINTEGER=int
# LIBS += /usr/local/opt/openblas/lib/libblas.dylib
#
#
# 3. Apple's framework accelerate
#
# This has the advantage that it does not require to install anything,
# as it is provided by default on the mac. It is not very fast, though.
#
CPPFLAGS += -DFINTEGER=int
LIBS += -framework Accelerate
##########################################################################
# SWIG and Python flags
##########################################################################
# SWIG executable. This should be at least version 3.x
# brew install swig
SWIG = /usr/local/bin/swig
# The Python include directories for the current python executable
PYTHON_INC=$(shell python -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())")
NUMPY_INC=$(shell python -c "import numpy ; print(numpy.get_include())")
PYTHONCFLAGS=-I${PYTHON_INC} -I${NUMPY_INC}
PYTHONLIB=-lpython
##########################################################################
# Faiss GPU
##########################################################################
# As we don't have access to a Mac with nvidia GPUs installed, we
# could not validate the GPU compile of Faiss.
-106
View File
@@ -1,106 +0,0 @@
# -*- makefile -*-
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# tested on Mac OS X 10.12.2 Sierra with additional software installed via macports
# The system default clang does not support openmp
# You can install an openmp compatible g++ with macports:
# port install g++-mp-6
CXX = /opt/local/bin/g++-mp-6 -std=c++11
CXXFLAGS = -fPIC -m64 -Wall -g -O3 -fopenmp -Wno-sign-compare
CPUFLAGS = -msse4 -mpopcnt
LDFLAGS = -g -fPIC -fopenmp
# common linux flags
SHAREDEXT = dylib
SHAREDFLAGS = -dynamiclib
MKDIR_P = mkdir -p
prefix ?= /usr/local
exec_prefix ?= ${prefix}
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
##########################################################################
# Uncomment one of the 4 BLAS/Lapack implementation options
# below. They are sorted # from fastest to slowest (in our
# experiments).
##########################################################################
#
# 1. Intel MKL
#
# This is the fastest BLAS implementation we tested. Unfortunately it
# is not open-source and determining the correct linking flags is a
# nightmare. See
#
# https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
#
# The latest tested version is MKL 2017.0.098 (2017 Initial Release) and can
# be downloaded here:
#
# https://registrationcenter.intel.com/en/forms/?productid=2558&licensetype=2
#
# The following settings are working if MKL is installed on its default folder:
#
# MKLROOT = /opt/intel/compilers_and_libraries/linux/mkl/
#
# LDFLAGS += -Wl,--no-as-needed -L$(MKLROOT)/lib/intel64
# LIBS += -lmkl_intel_ilp64 -lmkl_core -lmkl_gnu_thread -ldl -lpthread
#
# CPPFLAGS += -DFINTEGER=long
#
# You may have to set the LD_LIBRARY_PATH=$MKLROOT/lib/intel64 at runtime.
#
# 2. Openblas
#
# The library contains both BLAS and Lapack. Install with port install OpenBLAS
#
# CPPFLAGS += -DFINTEGER=int
# LIBS += /opt/local/lib/libopenblas.dylib
#
#
# 3. Apple's framework accelerate
#
# This has the advantage that it does not require to install anything,
# as it is provided by default on the mac. It is not very fast, though.
#
CPPFLAGS += -DFINTEGER=int
LIBS += -framework Accelerate
##########################################################################
# SWIG and Python flags
##########################################################################
# SWIG executable. This should be at least version 3.x
# port install swig swig-python
SWIG = /opt/local/bin/swig
# The Python include directories for the current python executable can
# typically be found with
#
# python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc()"
# python -c "import numpy ; print numpy.get_include()"
#
# the paths below are for the system python (not the macports one)
PYTHONCFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 \
-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include
PYTHONLIB=-lpython
##########################################################################
# Faiss GPU
##########################################################################
# As we don't have access to a Mac with nvidia GPUs installed, we
# could not validate the GPU compile of Faiss.
+181
View File
@@ -0,0 +1,181 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
add_library(faiss
AutoTune.cpp
Clustering.cpp
DirectMap.cpp
IVFlib.cpp
Index.cpp
Index2Layer.cpp
IndexBinary.cpp
IndexBinaryFlat.cpp
IndexBinaryFromFloat.cpp
IndexBinaryHNSW.cpp
IndexBinaryHash.cpp
IndexBinaryIVF.cpp
IndexFlat.cpp
IndexHNSW.cpp
IndexIVF.cpp
IndexIVFFlat.cpp
IndexIVFPQ.cpp
IndexIVFPQR.cpp
IndexIVFSpectralHash.cpp
IndexLSH.cpp
IndexLattice.cpp
IndexPQ.cpp
IndexPreTransform.cpp
IndexReplicas.cpp
IndexScalarQuantizer.cpp
IndexShards.cpp
InvertedLists.cpp
MatrixStats.cpp
MetaIndexes.cpp
OnDiskInvertedLists.cpp
VectorTransform.cpp
clone_index.cpp
index_factory.cpp
impl/AuxIndexStructures.cpp
impl/FaissException.cpp
impl/HNSW.cpp
impl/PolysemousTraining.cpp
impl/ProductQuantizer.cpp
impl/ScalarQuantizer.cpp
impl/index_read.cpp
impl/index_write.cpp
impl/io.cpp
impl/lattice_Zn.cpp
utils/Heap.cpp
utils/WorkerThread.cpp
utils/distances.cpp
utils/distances_simd.cpp
utils/extra_distances.cpp
utils/hamming.cpp
utils/random.cpp
utils/utils.cpp
)
set(FAISS_HEADERS
AutoTune.h
Clustering.h
DirectMap.h
IVFlib.h
Index.h
Index2Layer.h
IndexBinary.h
IndexBinaryFlat.h
IndexBinaryFromFloat.h
IndexBinaryHNSW.h
IndexBinaryHash.h
IndexBinaryIVF.h
IndexFlat.h
IndexHNSW.h
IndexIVF.h
IndexIVFFlat.h
IndexIVFPQ.h
IndexIVFPQR.h
IndexIVFSpectralHash.h
IndexLSH.h
IndexLattice.h
IndexPQ.h
IndexPreTransform.h
IndexReplicas.h
IndexScalarQuantizer.h
IndexShards.h
InvertedLists.h
MatrixStats.h
MetaIndexes.h
MetricType.h
OnDiskInvertedLists.h
VectorTransform.h
clone_index.h
index_factory.h
index_io.h
impl/AuxIndexStructures.h
impl/FaissAssert.h
impl/FaissException.h
impl/HNSW.h
impl/PolysemousTraining.h
impl/ProductQuantizer-inl.h
impl/ProductQuantizer.h
impl/ScalarQuantizer.h
impl/ThreadedIndex-inl.h
impl/ThreadedIndex.h
impl/io.h
impl/io_macros.h
impl/lattice_Zn.h
utils/Heap.h
utils/WorkerThread.h
utils/distances.h
utils/extra_distances.h
utils/hamming-inl.h
utils/hamming.h
utils/random.h
utils/utils.h
)
if(FAISS_OPT_LEVEL STREQUAL "avx2")
target_compile_options(faiss PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-mavx2 -mpopcnt>)
set_target_properties(faiss PROPERTIES OUTPUT_NAME "faiss_avx2")
elseif(FAISS_OPT_LEVEL STREQUAL "sse4")
target_compile_options(faiss PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-msse4 -mpopcnt>)
set_target_properties(faiss PROPERTIES OUTPUT_NAME "faiss_sse4")
endif()
# Handle `#include <faiss/foo.h>`.
target_include_directories(faiss PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
# NOTE: This is needed for building faiss as a static library that will then be
# linked into a shared library.
set_property(TARGET faiss PROPERTY POSITION_INDEPENDENT_CODE ON)
target_compile_definitions(faiss PRIVATE FINTEGER=int)
find_package(OpenMP REQUIRED)
target_link_libraries(faiss PRIVATE OpenMP::OpenMP_CXX)
find_package(MKL)
if(MKL_FOUND)
target_link_libraries(faiss PRIVATE ${MKL_LIBRARIES})
else()
find_package(BLAS REQUIRED)
target_link_libraries(faiss PRIVATE ${BLAS_LIBRARIES})
find_package(LAPACK REQUIRED)
target_link_libraries(faiss PRIVATE ${LAPACK_LIBRARIES})
endif()
install(TARGETS faiss
EXPORT faiss-targets
INCLUDES DESTINATION include
)
foreach(header ${FAISS_HEADERS})
get_filename_component(dir ${header} DIRECTORY )
install(FILES ${header}
DESTINATION include/faiss/${dir}
)
endforeach()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/cmake/faiss-config-version.cmake"
VERSION ${CMAKE_PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(${PROJECT_SOURCE_DIR}/cmake/faiss-config.cmake.in
${PROJECT_BINARY_DIR}/cmake/faiss-config.cmake
COPYONLY
)
install(FILES ${PROJECT_BINARY_DIR}/cmake/faiss-config.cmake
${PROJECT_BINARY_DIR}/cmake/faiss-config-version.cmake
DESTINATION share/faiss
)
install(EXPORT faiss-targets
DESTINATION share/faiss
)
+183
View File
@@ -0,0 +1,183 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
target_sources(faiss PRIVATE
GpuAutoTune.cpp
GpuCloner.cpp
GpuClonerOptions.cpp
GpuDistance.cu
GpuIndex.cu
GpuIndexBinaryFlat.cu
GpuIndexFlat.cu
GpuIndexIVF.cu
GpuIndexIVFFlat.cu
GpuIndexIVFPQ.cu
GpuIndexIVFScalarQuantizer.cu
GpuResources.cpp
StandardGpuResources.cpp
impl/BinaryDistance.cu
impl/BinaryFlatIndex.cu
impl/BroadcastSum.cu
impl/Distance.cu
impl/FlatIndex.cu
impl/IVFAppend.cu
impl/IVFBase.cu
impl/IVFFlat.cu
impl/IVFFlatScan.cu
impl/IVFPQ.cu
impl/IVFUtils.cu
impl/IVFUtilsSelect1.cu
impl/IVFUtilsSelect2.cu
impl/L2Norm.cu
impl/L2Select.cu
impl/PQScanMultiPassPrecomputed.cu
impl/RemapIndices.cpp
impl/VectorResidual.cu
utils/BlockSelectFloat.cu
utils/BlockSelectHalf.cu
utils/DeviceUtils.cu
utils/Float16.cu
utils/MatrixMult.cu
utils/StackDeviceMemory.cpp
utils/Timer.cpp
utils/WarpSelectFloat.cu
utils/WarpSelectHalf.cu
utils/blockselect/BlockSelectFloat1.cu
utils/blockselect/BlockSelectFloat128.cu
utils/blockselect/BlockSelectFloat256.cu
utils/blockselect/BlockSelectFloat32.cu
utils/blockselect/BlockSelectFloat64.cu
utils/blockselect/BlockSelectFloatF1024.cu
utils/blockselect/BlockSelectFloatF2048.cu
utils/blockselect/BlockSelectFloatF512.cu
utils/blockselect/BlockSelectFloatT1024.cu
utils/blockselect/BlockSelectFloatT2048.cu
utils/blockselect/BlockSelectFloatT512.cu
utils/blockselect/BlockSelectHalf1.cu
utils/blockselect/BlockSelectHalf128.cu
utils/blockselect/BlockSelectHalf256.cu
utils/blockselect/BlockSelectHalf32.cu
utils/blockselect/BlockSelectHalf64.cu
utils/blockselect/BlockSelectHalfF1024.cu
utils/blockselect/BlockSelectHalfF2048.cu
utils/blockselect/BlockSelectHalfF512.cu
utils/blockselect/BlockSelectHalfT1024.cu
utils/blockselect/BlockSelectHalfT2048.cu
utils/blockselect/BlockSelectHalfT512.cu
utils/nvidia/fp16_emu.cu
utils/warpselect/WarpSelectFloat1.cu
utils/warpselect/WarpSelectFloat128.cu
utils/warpselect/WarpSelectFloat256.cu
utils/warpselect/WarpSelectFloat32.cu
utils/warpselect/WarpSelectFloat64.cu
utils/warpselect/WarpSelectFloatF1024.cu
utils/warpselect/WarpSelectFloatF2048.cu
utils/warpselect/WarpSelectFloatF512.cu
utils/warpselect/WarpSelectFloatT1024.cu
utils/warpselect/WarpSelectFloatT2048.cu
utils/warpselect/WarpSelectFloatT512.cu
utils/warpselect/WarpSelectHalf1.cu
utils/warpselect/WarpSelectHalf128.cu
utils/warpselect/WarpSelectHalf256.cu
utils/warpselect/WarpSelectHalf32.cu
utils/warpselect/WarpSelectHalf64.cu
utils/warpselect/WarpSelectHalfF1024.cu
utils/warpselect/WarpSelectHalfF2048.cu
utils/warpselect/WarpSelectHalfF512.cu
utils/warpselect/WarpSelectHalfT1024.cu
utils/warpselect/WarpSelectHalfT2048.cu
utils/warpselect/WarpSelectHalfT512.cu
)
set(FAISS_GPU_HEADERS
GpuAutoTune.h
GpuCloner.h
GpuClonerOptions.h
GpuDistance.h
GpuFaissAssert.h
GpuIndexBinaryFlat.h
GpuIndexFlat.h
GpuIndex.h
GpuIndexIVFFlat.h
GpuIndexIVF.h
GpuIndexIVFPQ.h
GpuIndexIVFScalarQuantizer.h
GpuIndicesOptions.h
GpuResources.h
StandardGpuResources.h
impl/BinaryDistance.cuh
impl/BinaryFlatIndex.cuh
impl/BroadcastSum.cuh
impl/Distance.cuh
impl/DistanceUtils.cuh
impl/FlatIndex.cuh
impl/GeneralDistance.cuh
impl/GpuScalarQuantizer.cuh
impl/IVFAppend.cuh
impl/IVFBase.cuh
impl/IVFFlat.cuh
impl/IVFFlatScan.cuh
impl/IVFPQ.cuh
impl/IVFUtils.cuh
impl/L2Norm.cuh
impl/L2Select.cuh
impl/PQCodeDistances.cuh
impl/PQCodeDistances-inl.cuh
impl/PQCodeLoad.cuh
impl/PQScanMultiPassNoPrecomputed.cuh
impl/PQScanMultiPassNoPrecomputed-inl.cuh
impl/PQScanMultiPassPrecomputed.cuh
impl/RemapIndices.h
impl/VectorResidual.cuh
utils/blockselect/BlockSelectImpl.cuh
utils/BlockSelectKernel.cuh
utils/Comparators.cuh
utils/ConversionOperators.cuh
utils/CopyUtils.cuh
utils/DeviceDefs.cuh
utils/DeviceTensor.cuh
utils/DeviceTensor-inl.cuh
utils/DeviceUtils.h
utils/DeviceVector.cuh
utils/Float16.cuh
utils/HostTensor.cuh
utils/HostTensor-inl.cuh
utils/Limits.cuh
utils/LoadStoreOperators.cuh
utils/MathOperators.cuh
utils/MatrixMult.cuh
utils/MatrixMult-inl.cuh
utils/MergeNetworkBlock.cuh
utils/MergeNetworkUtils.cuh
utils/MergeNetworkWarp.cuh
utils/NoTypeTensor.cuh
utils/nvidia/fp16_emu.cuh
utils/Pair.cuh
utils/PtxUtils.cuh
utils/ReductionOperators.cuh
utils/Reductions.cuh
utils/Select.cuh
utils/StackDeviceMemory.h
utils/StaticUtils.h
utils/Tensor.cuh
utils/Tensor-inl.cuh
utils/ThrustAllocator.cuh
utils/Timer.h
utils/Transpose.cuh
utils/WarpSelectKernel.cuh
utils/warpselect/WarpSelectImpl.cuh
utils/WarpShuffles.cuh
)
foreach(header ${FAISS_GPU_HEADERS})
get_filename_component(dir ${header} DIRECTORY )
install(FILES ${header}
DESTINATION include/faiss/gpu/${dir}
)
endforeach()
find_package(CUDAToolkit REQUIRED)
target_link_libraries(faiss PRIVATE CUDA::cuda_driver CUDA::cudart CUDA::cublas)
+34
View File
@@ -0,0 +1,34 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
find_package(CUDAToolkit REQUIRED)
# Defines `gtest_discover_tests()`.
include(GoogleTest)
add_library(faiss_gpu_test_helper TestUtils.cpp)
target_link_libraries(faiss_gpu_test_helper PUBLIC faiss gtest CUDA::cuda_driver)
macro(faiss_gpu_test file)
get_filename_component(test_name ${file} NAME_WE)
add_executable(${test_name} ${file})
target_link_libraries(${test_name} PRIVATE faiss_gpu_test_helper)
gtest_discover_tests(${test_name})
endmacro()
faiss_gpu_test(TestGpuIndexFlat.cpp)
faiss_gpu_test(TestGpuIndexIVFFlat.cpp)
faiss_gpu_test(TestGpuIndexBinaryFlat.cpp)
faiss_gpu_test(TestGpuMemoryException.cpp)
faiss_gpu_test(TestGpuIndexIVFPQ.cpp)
faiss_gpu_test(TestGpuDistance.cu)
faiss_gpu_test(TestGpuSelect.cu)
add_executable(demo_ivfpq_indexing_gpu EXCLUDE_FROM_ALL
demo_ivfpq_indexing_gpu.cpp)
target_link_libraries(demo_ivfpq_indexing_gpu
PRIVATE faiss gtest_main CUDA::cudart)
-54
View File
@@ -1,54 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
-include ../../makefile.inc
TESTS_SRC = TestGpuIndexFlat.cpp TestGpuIndexIVFPQ.cpp \
TestGpuIndexBinaryFlat.cpp TestGpuIndexIVFFlat.cpp TestGpuMemoryException.cpp
CUDA_TESTS_SRC = TestGpuSelect.cu
TESTS_OBJ = $(TESTS_SRC:.cpp=.o)
CUDA_TESTS_OBJ = $(CUDA_TESTS_SRC:.cu=.o)
TESTS_BIN = $(TESTS_OBJ:.o=) $(CUDA_TESTS_OBJ:.o=)
# test_gpu_index.py test_pytorch_faiss.py
run: $(TESTS_BIN) $(CUDA_TESTS_BIN)
for t in $(TESTS_BIN) $(CUDA_TESTS_BIN); do ./$$t || exit; done
$(CUDA_TESTS_OBJ): %.o: %.cu gtest
$(NVCC) $(NVCCFLAGS) -g -O3 -o $@ -c $< -Igtest/include -I../..
$(TESTS_OBJ): %.o: %.cpp gtest
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -o $@ -c $< -Igtest/include -I../..
$(TESTS_BIN): %: %.o TestUtils.o ../../libfaiss.a gtest/make/gtest.a
$(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
demo_ivfpq_indexing_gpu: demo_ivfpq_indexing_gpu.o ../../libfaiss.a
$(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
demo_ivfpq_indexing_gpu.o: demo_ivfpq_indexing_gpu.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -o $@ -c $^ -I../..
TestUtils.o: TestUtils.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -o $@ -c $^ -Igtest/include -I../..
gtest/make/gtest.a: gtest
$(MAKE) -C gtest/make CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" gtest.a
gtest:
curl -L https://github.com/google/googletest/archive/release-1.8.0.tar.gz | tar xz && \
mv googletest-release-1.8.0/googletest gtest && \
rm -rf googletest-release-1.8.0
clean:
rm -f *.o $(TESTS_BIN)
rm -rf gtest
rm -f demo_ivfpq_indexing_gpu
.PHONY: clean run
+85
View File
@@ -0,0 +1,85 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
project(pyfaiss
DESCRIPTION "Python bindings for faiss."
HOMEPAGE_URL "https://github.com/facebookresearch/faiss"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
find_package(SWIG REQUIRED COMPONENTS python)
include(${SWIG_USE_FILE})
set(UseSWIG_TARGET_NAME_PREFERENCE STANDARD)
set(SWIG_SOURCE_FILE_EXTENSIONS swig)
set_source_files_properties(swigfaiss.swig PROPERTIES
CPLUSPLUS ON
USE_TARGET_INCLUDE_DIRECTORIES TRUE
)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set_source_files_properties(swigfaiss.swig PROPERTIES
SWIG_FLAGS -DSWIGWORDSIZE64
)
endif()
swig_add_library(swigfaiss
TYPE SHARED
LANGUAGE python
SOURCES swigfaiss.swig
)
# NOTE: Python does not recognize the dylib extension.
set_target_properties(swigfaiss PROPERTIES SUFFIX .so)
if(FAISS_ENABLE_GPU)
find_package(CUDAToolkit REQUIRED)
target_link_libraries(swigfaiss PRIVATE CUDA::cudart)
set_source_files_properties(swigfaiss.swig PROPERTIES
COMPILE_DEFINITIONS GPU_WRAPPER
)
endif()
if(NOT TARGET faiss)
find_package(faiss REQUIRED)
endif()
target_link_libraries(swigfaiss PRIVATE faiss Python::Module Python::NumPy)
# Hack so that python_callbacks.h can be included as
# `#include <faiss/python/python_callbacks.h>`.
target_include_directories(swigfaiss PRIVATE ${PROJECT_SOURCE_DIR}/../../)
find_package(Python REQUIRED
COMPONENTS Development NumPy
)
add_library(faiss_python_callbacks EXCLUDE_FROM_ALL
python_callbacks.cpp
)
set_property(TARGET faiss_python_callbacks
PROPERTY POSITION_INDEPENDENT_CODE ON
)
# Hack so that python_callbacks.h can be included as
# `#include <faiss/python/python_callbacks.h>`.
target_include_directories(faiss_python_callbacks PRIVATE ${PROJECT_SOURCE_DIR}/../../)
target_include_directories(faiss_python_callbacks PRIVATE ${Python_INCLUDE_DIRS})
target_link_libraries(faiss_python_callbacks PRIVATE faiss)
target_link_libraries(swigfaiss PRIVATE faiss faiss_python_callbacks)
configure_file(setup.py setup.py COPYONLY)
configure_file(__init__.py __init__.py COPYONLY)
configure_file(loader.py loader.py COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/../../contrib/client_server.py contrib/client_server.py COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/../../contrib/exhaustive_search.py contrib/exhaustive_search.py COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/../../contrib/ondisk.py contrib/ondisk.py COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/../../contrib/rpc.py contrib/rpc.py COPYONLY)
-39
View File
@@ -1,39 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
-include ../../makefile.inc
ifneq ($(strip $(NVCC)),)
SWIGFLAGS += -DGPU_WRAPPER
endif
all: build
# Also silently generates swigfaiss.py.
swigfaiss.cpp: swigfaiss.swig ../../libfaiss.a
$(SWIG) -python -c++ -Doverride= -I../.. $(SWIGFLAGS) -o $@ $<
swigfaiss_avx2.cpp: swigfaiss.swig ../../libfaiss.a
$(SWIG) -python -c++ -Doverride= -module swigfaiss_avx2 -I../.. $(SWIGFLAGS) -o $@ $<
%.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) $(PYTHONCFLAGS) \
-I../.. -c $< -o $@
# Extension is .so even on OSX.
_%.so: %.o python_callbacks.o ../../libfaiss.a
$(CXX) $(SHAREDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
build: _swigfaiss.so __init__.py loader.py
$(PYTHON) setup.py build
install: build
$(PYTHON) setup.py install
clean:
rm -f swigfaiss*.cpp swigfaiss*.o swigfaiss*.py _swigfaiss*.so
rm -rf build/
.PHONY: all build clean install
+2 -1
View File
@@ -13,6 +13,7 @@ if not os.path.exists(check_fpath):
# make the faiss python package dir
shutil.rmtree("faiss", ignore_errors=True)
os.mkdir("faiss")
shutil.copytree("contrib", "faiss/contrib")
shutil.copyfile("__init__.py", "faiss/__init__.py")
shutil.copyfile("loader.py", "faiss/loader.py")
shutil.copyfile("swigfaiss.py", "faiss/swigfaiss.py")
@@ -43,7 +44,7 @@ setup(
keywords='search nearest neighbors',
install_requires=['numpy'],
packages=['faiss'],
packages=['faiss', 'faiss.contrib'],
package_data={
'faiss': ['*.so'],
},
-45
View File
@@ -1,45 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
CXX = @CXX@
CXXCPP = @CXXCPP@
CPPFLAGS = -DFINTEGER=int @CPPFLAGS@ @OPENMP_CXXFLAGS@ @NVCC_CPPFLAGS@
CXXFLAGS = -fPIC @ARCH_CXXFLAGS@ -Wno-sign-compare @CXXFLAGS@
CPUFLAGS = @ARCH_CPUFLAGS@
LDFLAGS = @OPENMP_LDFLAGS@ @LDFLAGS@ @NVCC_LDFLAGS@
LIBS = @BLAS_LIBS@ @LAPACK_LIBS@ @LIBS@ @NVCC_LIBS@
PYTHONCFLAGS = @PYTHON_CFLAGS@ -I@NUMPY_INCLUDE@
SWIGFLAGS = -DSWIGWORDSIZE64
NVCC = @NVCC@
CUDA_ROOT = @CUDA_PREFIX@
CUDA_ARCH = @CUDA_ARCH@
NVCCFLAGS = -I $(CUDA_ROOT)/targets/x86_64-linux/include/ \
-Xcompiler -fPIC \
-Xcudafe --diag_suppress=unrecognized_attribute \
$(CUDA_ARCH) \
-lineinfo \
-ccbin $(CXX) -DFAISS_USE_FLOAT16
OS = $(shell uname -s)
SHAREDEXT = so
SHAREDFLAGS = -shared
ifeq ($(OS),Darwin)
SHAREDEXT = dylib
SHAREDFLAGS = -dynamiclib -undefined dynamic_lookup
SWIGFLAGS =
endif
MKDIR_P = @MKDIR_P@
PYTHON = @PYTHON@
SWIG = @SWIG@
AR ?= ar
prefix ?= @prefix@
exec_prefix ?= @exec_prefix@
libdir = @libdir@
includedir = @includedir@
+37
View File
@@ -0,0 +1,37 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
add_executable(faiss_test
test_binary_flat.cpp
test_dealloc_invlists.cpp
test_ivfpq_codec.cpp
test_ivfpq_indexing.cpp
test_lowlevel_ivf.cpp
test_merge.cpp
test_omp_threads.cpp
test_ondisk_ivf.cpp
test_pairs_decoding.cpp
test_params_override.cpp
test_pq_encoding.cpp
test_sliding_ivf.cpp
test_threaded_index.cpp
test_transfer_invlists.cpp
)
include(FetchContent)
FetchContent_Declare(googletest
URL "https://github.com/google/googletest/archive/release-1.10.0.tar.gz")
set(BUILD_GMOCK CACHE BOOL OFF)
set(INSTALL_GTEST CACHE BOOL OFF)
FetchContent_MakeAvailable(googletest)
target_link_libraries(faiss_test PRIVATE
faiss
gtest_main)
# Defines `gtest_discover_tests()`.
include(GoogleTest)
gtest_discover_tests(faiss_test)
-37
View File
@@ -1,37 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
-include ../makefile.inc
TESTS_SRC = $(wildcard *.cpp)
TESTS_OBJ = $(TESTS_SRC:.cpp=.o)
all: run
run: tests
./tests
tests: $(TESTS_OBJ) ../libfaiss.a gtest/make/gtest_main.a
$(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)
%.o: %.cpp gtest
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CPUFLAGS) -c -o $@ $< -Igtest/include -I..
gtest/make/gtest_main.a: gtest
$(MAKE) -C gtest/make CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" gtest_main.a
gtest:
curl -L https://github.com/google/googletest/archive/release-1.8.0.tar.gz | tar xz && \
mv googletest-release-1.8.0/googletest gtest && \
rm -rf googletest-release-1.8.0
clean:
rm -f tests
rm -f $(TESTS_OBJ)
rm -rf gtest
.PHONY: all clean run
+1 -1
View File
@@ -3,7 +3,7 @@ import unittest
import numpy as np
from common import get_dataset_2
from faiss_contrib.exhaustive_search import knn_ground_truth
from faiss.contrib.exhaustive_search import knn_ground_truth
class TestComputeGT(unittest.TestCase):
+20
View File
@@ -0,0 +1,20 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
add_executable(1-Flat EXCLUDE_FROM_ALL 1-Flat.cpp)
target_link_libraries(1-Flat PRIVATE faiss)
add_executable(2-IVFFlat EXCLUDE_FROM_ALL 2-IVFFlat.cpp)
target_link_libraries(2-IVFFlat PRIVATE faiss)
add_executable(3-IVFPQ EXCLUDE_FROM_ALL 3-IVFPQ.cpp)
target_link_libraries(3-IVFPQ PRIVATE faiss)
add_executable(4-GPU EXCLUDE_FROM_ALL 4-GPU.cpp)
target_link_libraries(4-GPU PRIVATE faiss)
add_executable(5-Multiple-GPUs EXCLUDE_FROM_ALL 5-Multiple-GPUs.cpp)
target_link_libraries(5-Multiple-GPUs PRIVATE faiss)
-25
View File
@@ -1,25 +0,0 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
-include ../../makefile.inc
CPU_TARGETS = 1-Flat 2-IVFFlat 3-IVFPQ
GPU_TARGETS = 4-GPU 5-Multiple-GPUs
default: cpu
all: cpu gpu
cpu: $(CPU_TARGETS)
gpu: $(GPU_TARGETS)
%: %.cpp ../../libfaiss.a
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) -I../../.. $(LIBS)
clean:
rm -f $(CPU_TARGETS) $(GPU_TARGETS)
.PHONY: all cpu default gpu clean