Skip to content

Commit

Permalink
Move from TravisCI to CircleCI (facebookresearch#1315)
Browse files Browse the repository at this point in the history
Summary:
Depends on facebookresearch#1313.

Pull Request resolved: facebookresearch#1315

Reviewed By: mdouze

Differential Revision: D23148557

Pulled By: beauby

fbshipit-source-id: 0a35f17d22aa04db6bd1c16cfc5ff8eee28f1f74
  • Loading branch information
beauby authored and facebook-github-bot committed Aug 15, 2020
1 parent a8e4c5e commit b7b261c
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 120 deletions.
111 changes: 111 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
version: 2.1

jobs:
build_linux:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
name: Register Intel APT repository for MKL
command: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
- run:
name: Install apt packages
command: |
sudo apt-get update
sudo apt-get install -y swig python3-dev intel-mkl-64bit-2020.0.088
echo "source /opt/intel/bin/compilervars.sh intel64" >> $BASH_ENV
- run:
name: Install numpy/scipy
command: |
pip install numpy scipy
- run:
name: Install cmake
command: |
wget -O - https://github.com/Kitware/CMake/releases/download/v3.17.1/cmake-3.17.1-Linux-x86_64.tar.gz | tar xzf -
sudo cp -R cmake-3.17.1-Linux-x86_64/* /usr
- run:
name: Build faiss library
command: |
source $BASH_ENV
cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF \
-DCMAKE_BUILD_TYPE=Release -DBLA_VENDOR=Intel10_64_dyn .
make -C build -j faiss
- run:
name: Test faiss library
command: |
source $BASH_ENV
make -C build -j faiss_test
make -C build test
environment:
OMP_NUM_THREADS: 10
- run:
name: Build python extension
command: |
source $BASH_ENV
make -C build -j swigfaiss
cd build/faiss/python
python setup.py build
- run:
name: Test python extension
command: |
source $BASH_ENV
export PYTHONPATH="$(ls -d ./build/faiss/python/build/lib*/)"
python -m unittest discover ./tests
environment:
OMP_NUM_THREADS: 10

build_osx:
macos:
xcode: 11.6.0
steps:
- checkout
- run:
name: Install Homebrew packages
command: |
brew install cmake swig libomp
- run:
name: Install numpy/scipy
command: |
pip3 install numpy scipy
- run:
name: Generate Makefiles
command: |
cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE=/usr/local/bin/python3 .
- run:
name: Build faiss library
command: |
make -C build -j faiss
- run:
name: Test faiss library
command: |
make -C build -j faiss_test
make -C build test
environment:
OMP_NUM_THREADS: 10
- run:
name: Build python extension
command: |
make -C build -j swigfaiss
cd build/faiss/python
python3 setup.py build
- run:
name: Test python extension
command: |
PYTHONPATH="$(ls -d ./build/faiss/python/build/lib*/)" python3 -m unittest discover ./tests
environment:
OMP_NUM_THREADS: 10

workflows:
version: 2
build:
jobs:
- build_linux
- build_osx
83 changes: 0 additions & 83 deletions .travis.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .travis/install.sh

This file was deleted.

16 changes: 7 additions & 9 deletions cmake/FindMKL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ Result Variables
This module defines the following variables:
``BLAS_FOUND``
``MKL_FOUND``
library implementing the BLAS interface is found
``BLAS_LINKER_FLAGS``
uncached list of required linker flags (excluding ``-l`` and ``-L``).
``BLAS_LIBRARIES``
``MKL_LIBRARIES``
uncached list of libraries (using full path name) to link against
to use BLAS (may be empty if compiler implicitly links BLAS)
to use MKL (may be empty if compiler implicitly links MKL)
.. note::
Expand All @@ -57,7 +55,7 @@ This module defines the following variables:
.. code-block:: cmake
set(BLA_VENDOR Intel10_64lp)
find_package(BLAS)
find_package(MKL)
Hints
^^^^^
Expand Down Expand Up @@ -166,7 +164,7 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro()

set(BLAS_LIBRARIES)
set(MKL_LIBRARIES)
if(NOT $ENV{BLA_VENDOR} STREQUAL "")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else()
Expand Down Expand Up @@ -225,7 +223,7 @@ if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
set(BLAS_SEARCH_LIBS "")

set(BLAS_mkl_SEARCH_SYMBOL sgemm)
set(_LIBRARIES BLAS_LIBRARIES)
set(_LIBRARIES MKL_LIBRARIES)
if(WIN32)
# Find the main file (32-bit or 64-bit)
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
Expand Down Expand Up @@ -359,7 +357,7 @@ if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
endif()


find_package_handle_standard_args(MKL REQUIRED_VARS BLAS_LIBRARIES)
find_package_handle_standard_args(MKL REQUIRED_VARS MKL_LIBRARIES)

cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
10 changes: 9 additions & 1 deletion faiss/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ if(NOT TARGET faiss)
find_package(faiss REQUIRED)
endif()

target_link_libraries(swigfaiss PRIVATE faiss Python::Module Python::NumPy)
find_package(OpenMP REQUIRED)

target_link_libraries(swigfaiss PRIVATE
faiss
Python::Module
Python::NumPy
OpenMP::OpenMP_CXX
)

# Hack so that python_callbacks.h can be included as
# `#include <faiss/python/python_callbacks.h>`.
target_include_directories(swigfaiss PRIVATE ${PROJECT_SOURCE_DIR}/../../)
Expand Down
6 changes: 5 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ set(BUILD_GMOCK CACHE BOOL OFF)
set(INSTALL_GTEST CACHE BOOL OFF)
FetchContent_MakeAvailable(googletest)

find_package(OpenMP REQUIRED)

target_link_libraries(faiss_test PRIVATE
faiss
gtest_main)
OpenMP::OpenMP_CXX
gtest_main
)

# Defines `gtest_discover_tests()`.
include(GoogleTest)
Expand Down

0 comments on commit b7b261c

Please sign in to comment.