Skip to content

Commit b7b261c

Browse files
beaubyfacebook-github-bot
authored andcommitted
Move from TravisCI to CircleCI (facebookresearch#1315)
Summary: Depends on facebookresearch#1313. Pull Request resolved: facebookresearch#1315 Reviewed By: mdouze Differential Revision: D23148557 Pulled By: beauby fbshipit-source-id: 0a35f17d22aa04db6bd1c16cfc5ff8eee28f1f74
1 parent a8e4c5e commit b7b261c

File tree

6 files changed

+132
-120
lines changed

6 files changed

+132
-120
lines changed

.circleci/config.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
version: 2.1
2+
3+
jobs:
4+
build_linux:
5+
docker:
6+
- image: circleci/python:3.7
7+
steps:
8+
- checkout
9+
- run:
10+
name: Register Intel APT repository for MKL
11+
command: |
12+
cd /tmp
13+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
14+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
15+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
16+
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
17+
- run:
18+
name: Install apt packages
19+
command: |
20+
sudo apt-get update
21+
sudo apt-get install -y swig python3-dev intel-mkl-64bit-2020.0.088
22+
echo "source /opt/intel/bin/compilervars.sh intel64" >> $BASH_ENV
23+
- run:
24+
name: Install numpy/scipy
25+
command: |
26+
pip install numpy scipy
27+
- run:
28+
name: Install cmake
29+
command: |
30+
wget -O - https://github.com/Kitware/CMake/releases/download/v3.17.1/cmake-3.17.1-Linux-x86_64.tar.gz | tar xzf -
31+
sudo cp -R cmake-3.17.1-Linux-x86_64/* /usr
32+
- run:
33+
name: Build faiss library
34+
command: |
35+
source $BASH_ENV
36+
cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF \
37+
-DCMAKE_BUILD_TYPE=Release -DBLA_VENDOR=Intel10_64_dyn .
38+
make -C build -j faiss
39+
- run:
40+
name: Test faiss library
41+
command: |
42+
source $BASH_ENV
43+
make -C build -j faiss_test
44+
make -C build test
45+
environment:
46+
OMP_NUM_THREADS: 10
47+
- run:
48+
name: Build python extension
49+
command: |
50+
source $BASH_ENV
51+
make -C build -j swigfaiss
52+
cd build/faiss/python
53+
python setup.py build
54+
- run:
55+
name: Test python extension
56+
command: |
57+
source $BASH_ENV
58+
export PYTHONPATH="$(ls -d ./build/faiss/python/build/lib*/)"
59+
python -m unittest discover ./tests
60+
environment:
61+
OMP_NUM_THREADS: 10
62+
63+
build_osx:
64+
macos:
65+
xcode: 11.6.0
66+
steps:
67+
- checkout
68+
- run:
69+
name: Install Homebrew packages
70+
command: |
71+
brew install cmake swig libomp
72+
- run:
73+
name: Install numpy/scipy
74+
command: |
75+
pip3 install numpy scipy
76+
- run:
77+
name: Generate Makefiles
78+
command: |
79+
cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF \
80+
-DCMAKE_BUILD_TYPE=Release \
81+
-DPython_EXECUTABLE=/usr/local/bin/python3 .
82+
- run:
83+
name: Build faiss library
84+
command: |
85+
make -C build -j faiss
86+
- run:
87+
name: Test faiss library
88+
command: |
89+
make -C build -j faiss_test
90+
make -C build test
91+
environment:
92+
OMP_NUM_THREADS: 10
93+
- run:
94+
name: Build python extension
95+
command: |
96+
make -C build -j swigfaiss
97+
cd build/faiss/python
98+
python3 setup.py build
99+
- run:
100+
name: Test python extension
101+
command: |
102+
PYTHONPATH="$(ls -d ./build/faiss/python/build/lib*/)" python3 -m unittest discover ./tests
103+
environment:
104+
OMP_NUM_THREADS: 10
105+
106+
workflows:
107+
version: 2
108+
build:
109+
jobs:
110+
- build_linux
111+
- build_osx

.travis.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.

.travis/install.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

cmake/FindMKL.cmake

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ Result Variables
4040
4141
This module defines the following variables:
4242
43-
``BLAS_FOUND``
43+
``MKL_FOUND``
4444
library implementing the BLAS interface is found
45-
``BLAS_LINKER_FLAGS``
46-
uncached list of required linker flags (excluding ``-l`` and ``-L``).
47-
``BLAS_LIBRARIES``
45+
``MKL_LIBRARIES``
4846
uncached list of libraries (using full path name) to link against
49-
to use BLAS (may be empty if compiler implicitly links BLAS)
47+
to use MKL (may be empty if compiler implicitly links MKL)
5048
5149
.. note::
5250
@@ -57,7 +55,7 @@ This module defines the following variables:
5755
.. code-block:: cmake
5856
5957
set(BLA_VENDOR Intel10_64lp)
60-
find_package(BLAS)
58+
find_package(MKL)
6159
6260
Hints
6361
^^^^^
@@ -166,7 +164,7 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
166164
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
167165
endmacro()
168166

169-
set(BLAS_LIBRARIES)
167+
set(MKL_LIBRARIES)
170168
if(NOT $ENV{BLA_VENDOR} STREQUAL "")
171169
set(BLA_VENDOR $ENV{BLA_VENDOR})
172170
else()
@@ -225,7 +223,7 @@ if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
225223
set(BLAS_SEARCH_LIBS "")
226224

227225
set(BLAS_mkl_SEARCH_SYMBOL sgemm)
228-
set(_LIBRARIES BLAS_LIBRARIES)
226+
set(_LIBRARIES MKL_LIBRARIES)
229227
if(WIN32)
230228
# Find the main file (32-bit or 64-bit)
231229
set(BLAS_SEARCH_LIBS_WIN_MAIN "")
@@ -359,7 +357,7 @@ if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
359357
endif()
360358

361359

362-
find_package_handle_standard_args(MKL REQUIRED_VARS BLAS_LIBRARIES)
360+
find_package_handle_standard_args(MKL REQUIRED_VARS MKL_LIBRARIES)
363361

364362
cmake_pop_check_state()
365363
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})

faiss/python/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ if(NOT TARGET faiss)
5151
find_package(faiss REQUIRED)
5252
endif()
5353

54-
target_link_libraries(swigfaiss PRIVATE faiss Python::Module Python::NumPy)
54+
find_package(OpenMP REQUIRED)
55+
56+
target_link_libraries(swigfaiss PRIVATE
57+
faiss
58+
Python::Module
59+
Python::NumPy
60+
OpenMP::OpenMP_CXX
61+
)
62+
5563
# Hack so that python_callbacks.h can be included as
5664
# `#include <faiss/python/python_callbacks.h>`.
5765
target_include_directories(swigfaiss PRIVATE ${PROJECT_SOURCE_DIR}/../../)

tests/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ set(BUILD_GMOCK CACHE BOOL OFF)
2828
set(INSTALL_GTEST CACHE BOOL OFF)
2929
FetchContent_MakeAvailable(googletest)
3030

31+
find_package(OpenMP REQUIRED)
32+
3133
target_link_libraries(faiss_test PRIVATE
3234
faiss
33-
gtest_main)
35+
OpenMP::OpenMP_CXX
36+
gtest_main
37+
)
3438

3539
# Defines `gtest_discover_tests()`.
3640
include(GoogleTest)

0 commit comments

Comments
 (0)