faiss/example_makefiles/makefile.inc.Mac.brew

101 lines
3.2 KiB
Plaintext
Raw Normal View History

2017-02-23 06:26:44 +08:00
# -*- makefile -*-
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD+Patents license found in the
# LICENSE file in the root directory of this source tree.
2017-02-23 06:26:44 +08:00
# 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
2017-02-23 06:26:44 +08:00
# common mac flags
SHAREDEXT = dylib
SHAREDFLAGS = -dynamiclib
MKDIR_P = mkdir -p
2017-02-23 06:26:44 +08:00
prefix ?= /usr/local
exec_prefix ?= ${prefix}
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
2017-02-23 06:26:44 +08:00
##########################################################################
# 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:
2017-02-23 06:26:44 +08:00
#
# https://registrationcenter.intel.com/en/forms/?productid=2558&licensetype=2
2017-02-23 06:26:44 +08:00
#
# The following settings are working if MKL is installed on its default folder:
2017-02-23 06:26:44 +08:00
#
# MKLROOT = /opt/intel/compilers_and_libraries/linux/mkl/
2017-02-23 06:26:44 +08:00
#
# LDFLAGS += -Wl,--no-as-needed -L$(MKLROOT)/lib/intel64
# LIBS += -lmkl_intel_ilp64 -lmkl_core -lmkl_gnu_thread -ldl -lpthread
2017-02-23 06:26:44 +08:00
#
# CPPFLAGS += -DFINTEGER=long
2017-02-23 06:26:44 +08:00
#
# You may have to set the LD_LIBRARY_PATH=$MKLROOT/lib/intel64 at runtime.
2017-02-23 06:26:44 +08:00
#
# 2. Openblas
#
# The library contains both BLAS and Lapack. Install with brew install OpenBLAS
2017-02-23 06:26:44 +08:00
#
# CPPFLAGS += -DFINTEGER=int
# LIBS += /usr/local/opt/openblas/lib/libblas.dylib
2017-02-23 06:26:44 +08:00
#
#
# 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
2017-02-23 06:26:44 +08:00
##########################################################################
# SWIG and Python flags
##########################################################################
# SWIG executable. This should be at least version 3.x
# brew install swig
SWIG = /usr/local/bin/swig
2017-02-23 06:26:44 +08:00
# The Python include directories for the current python executable
2017-02-23 06:26:44 +08:00
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
2017-02-23 06:26:44 +08:00
##########################################################################
# Faiss GPU
##########################################################################
# As we don't have access to a Mac with nvidia GPUs installed, we
# could not validate the GPU compile of Faiss.