Skip to content

Installation and Compiler Setup

Ilya Razenshteyn edited this page Oct 14, 2016 · 6 revisions

Installation and Compiler Setup

If you want to use a Python wrapper, your best bet is to install FALCONN as follows:

pip install FALCONN

Then, check that everything works by running import falconn within Python's REPL.

Otherwise, you can get the FALCONN source code by cloning our git repository hosted on github:

git clone https://github.com/FALCONN-LIB/falconn.git

FALCONN is a header-only C++ library. In order to use FALCONN in your programs, you only need to add the folder src/include to your include path (e.g., via the -I switch for gcc / g++ and clang). All FALCONN headers are in a subfolder falconn inside src/include so that FALCONN does not pollute your include path.

If installing FALCONN via pip does not work, try to clone the repository, and type make python_package_install. This requires NumPy and swig of version at least 3.0.8.

Dependencies

FALCONN's only dependency is the Eigen library for linear algebra. Eigen is header-only as well, so you just need to make sure that the Eigen header files are in your include path. If you already have a recent version of Eigen installed on your system, you might want to use this version. FALCONN has been tested with Eigen 3.2 and later. FALCONN assumes that the Eigen headers are accessible as #include <Eigen/Dense> etc.

If you do not have installed Eigen, you can simply use the version we have included in the FALCONN repository. In order to do so, add external/eigen to your include patah (again, you can use the -I compiler switch for gcc and others). Currently we include the 3.3-beta1 version of Eigen in the FALCONN repository because it utilizes AVX and hence has the same memory alignment as our AVX-accelerated code.

Compilation advice

FALCONN (along with Eigen) uses special vector instructions (AVX) in order to speed up linear algebra operations. Often, you need to instruct your compiler to take full advantage of your CPU. For instance, if you use gcc, add the -march=native flag. For some versions of clang for OS X, this does not work as intended, so you might need to use -march=corei7-avx instead (if you have a CPU supporting AVX).

If you want to maximize the performance of FALCONN, you should probably also add the -O2 or -O3 flag for gcc or clang.

For more details concerning compiler flags, see the example we provide.

Clone this wiki locally