Skip to content

Commit 7492d23

Browse files
beaubyfacebook-github-bot
authored andcommitted
Fix packaging (#2121)
Summary: - Disable problematic tests on OSX. - Ensure compiler compatibility with CUDA builds. - Fix path for Python extension libraries. - Use CentOS for CUDA packaging. - Update CUDA versions in CI (10.2 and 11.3). Pull Request resolved: #2121 Reviewed By: mdouze Differential Revision: D32921117 Pulled By: beauby fbshipit-source-id: 588c18add8084b8228ff5abc651eaa4567919cc6
1 parent 812e97d commit 7492d23

8 files changed

Lines changed: 21 additions & 98 deletions

File tree

.circleci/config.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ jobs:
221221
build_linux_gpu:
222222
machine:
223223
resource_class: gpu.nvidia.medium
224-
image: ubuntu-1604-cuda-10.1:201909-23
224+
image: ubuntu-2004-cuda-11.4:202110-01
225225
docker_layer_caching: true
226226
steps:
227227
- checkout
@@ -266,6 +266,8 @@ jobs:
266266
type: string
267267
cuda_archs:
268268
type: string
269+
compiler_version:
270+
type: string
269271
machine:
270272
resource_class: gpu.nvidia.medium
271273
image: ubuntu-1604-cuda-10.1:201909-23
@@ -281,7 +283,7 @@ jobs:
281283
-e CUDA_ARCHS="<<parameters.cuda_archs>>" \
282284
-e ANACONDA_API_TOKEN=$ANACONDA_API_TOKEN \
283285
faiss \
284-
conda build faiss-gpu --variants '{ "cudatoolkit": "<<parameters.cuda>>" }' \
286+
conda build faiss-gpu --variants '{ "cudatoolkit": "<<parameters.cuda>>", "c_compiler_version": "<<parameters.compiler_version>>", "cxx_compiler_version": "<<parameters.compiler_version>>" }' \
285287
--user pytorch --label <<parameters.label>>
286288
no_output_timeout: 60m
287289

@@ -368,28 +370,11 @@ workflows:
368370
only: /^v.*/
369371
branches:
370372
ignore: /.*/
371-
- deploy_linux_gpu:
372-
name: Linux GPU packages (CUDA 10.1)
373-
cuda: "10.1"
374-
cuda_archs: "35;52;60;61;70;72;75"
375-
filters:
376-
tags:
377-
only: /^v.*/
378-
branches:
379-
ignore: /.*/
380373
- deploy_linux_gpu:
381374
name: Linux GPU packages (CUDA 10.2)
382375
cuda: "10.2"
383376
cuda_archs: "35;52;60;61;70;72;75"
384-
filters:
385-
tags:
386-
only: /^v.*/
387-
branches:
388-
ignore: /.*/
389-
- deploy_linux_gpu:
390-
name: Linux GPU packages (CUDA 11.0)
391-
cuda: "11.0"
392-
cuda_archs: "60;61;70;72;75;80"
377+
compiler_version: "8.4"
393378
filters:
394379
tags:
395380
only: /^v.*/
@@ -399,6 +384,7 @@ workflows:
399384
name: Linux GPU packages (CUDA 11.3)
400385
cuda: "11.3"
401386
cuda_archs: "60;61;70;72;75;80;86"
387+
compiler_version: "9.3"
402388
filters:
403389
tags:
404390
only: /^v.*/
@@ -431,25 +417,17 @@ workflows:
431417
- deploy_linux:
432418
name: Linux nightlies
433419
label: nightly
434-
- deploy_linux_gpu:
435-
name: Linux GPU nightlies (CUDA 10.1)
436-
cuda: "10.1"
437-
cuda_archs: "35;52;60;61;70;72;75"
438-
label: nightly
439420
- deploy_linux_gpu:
440421
name: Linux GPU nightlies (CUDA 10.2)
441422
cuda: "10.2"
442423
cuda_archs: "35;52;60;61;70;72;75"
443-
label: nightly
444-
- deploy_linux_gpu:
445-
name: Linux GPU nightlies (CUDA 11.0)
446-
cuda: "11.0"
447-
cuda_archs: "60;61;70;72;75;80"
424+
compiler_version: "8.4"
448425
label: nightly
449426
- deploy_linux_gpu:
450427
name: Linux GPU nightlies (CUDA 11.3)
451428
cuda: "11.3"
452429
cuda_archs: "60;61;70;72;75;80;86"
430+
compiler_version: "9.3"
453431
label: nightly
454432
- deploy_windows:
455433
name: Windows nightlies

conda/Dockerfile.cuda10.1

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

conda/Dockerfile.cuda10.2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
FROM nvidia/cuda:10.2-devel-ubuntu18.04
6+
FROM nvidia/cuda:10.2-devel-centos8
77

8-
RUN apt-get update && apt-get install -y wget git libcublas-dev
8+
RUN yum install -y wget git libcublas-devel-10-2
99

1010
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
1111
bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3

conda/Dockerfile.cuda11.0

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

conda/Dockerfile.cuda11.3

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
FROM nvidia/cuda:11.3.0-devel-ubuntu18.04
6+
FROM nvidia/cuda:11.3.1-devel-centos8
77

8-
RUN apt-get update && apt-get install -y wget git libcublas-dev-11-3
8+
RUN yum install -y wget git libcublas-devel-11-3
99

1010
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
1111
bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3

conda/faiss-gpu/build-lib.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
set -e
88

99

10-
# Build libfaiss_avx2.so.
10+
# Build libfaiss.so/libfaiss_avx2.so.
1111
cmake -B _build \
1212
-DBUILD_SHARED_LIBS=ON \
1313
-DBUILD_TESTING=OFF \
@@ -16,10 +16,10 @@ cmake -B _build \
1616
-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCHS}" \
1717
-DFAISS_ENABLE_PYTHON=OFF \
1818
-DBLA_VENDOR=Intel10_64lp \
19+
-DCMAKE_INSTALL_LIBDIR=lib \
1920
-DCMAKE_BUILD_TYPE=Release .
2021

21-
make -C _build -j $CPU_COUNT faiss
22-
make -C _build -j $CPU_COUNT faiss_avx2
22+
make -C _build -j $CPU_COUNT faiss faiss_avx2
2323

2424
cmake --install _build --prefix $PREFIX
2525
cmake --install _build --prefix _libfaiss_stage/

tests/test_index_binary.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# LICENSE file in the root directory of this source tree.
55

66
"""this is a basic test script for simple indices work"""
7-
from __future__ import absolute_import, division, print_function, unicode_literals
87

8+
import os
99
import sys
1010
import numpy as np
1111
import unittest
@@ -340,6 +340,8 @@ def test_hnsw(self):
340340

341341
class TestReplicasAndShards(unittest.TestCase):
342342

343+
@unittest.skipIf(os.name == "posix" and os.uname().sysname == "Darwin",
344+
"There is a bug in the OpenMP implementation on OSX.")
343345
def test_replicas(self):
344346
d = 32
345347
nq = 100
@@ -352,13 +354,6 @@ def test_replicas(self):
352354

353355
Dref, Iref = index_ref.search(xq, 10)
354356

355-
# there is a OpenMP bug in this configuration, so disable threading
356-
if sys.platform == "darwin" and "Clang 12" in sys.version:
357-
nthreads = faiss.omp_get_max_threads()
358-
faiss.omp_set_num_threads(1)
359-
else:
360-
nthreads = None
361-
362357
nrep = 5
363358
index = faiss.IndexBinaryReplicas()
364359
for _i in range(nrep):
@@ -379,9 +374,6 @@ def test_replicas(self):
379374
index2.add(xb)
380375
D2, I2 = index2.search(xq, 10)
381376

382-
if nthreads is not None:
383-
faiss.omp_set_num_threads(nthreads)
384-
385377
self.assertTrue((Dref == D2).all())
386378
self.assertTrue((Iref == I2).all())
387379

tests/test_meta_index.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
from __future__ import absolute_import, division, print_function, unicode_literals
7-
8-
# translation of test_meta_index.lua
9-
6+
import os
107
import sys
118
import numpy as np
129
import faiss
@@ -78,6 +75,8 @@ def test_id_remap_ivf(self):
7875

7976
class Shards(unittest.TestCase):
8077

78+
@unittest.skipIf(os.name == "posix" and os.uname().sysname == "Darwin",
79+
"There is a bug in the OpenMP implementation on OSX.")
8180
def test_shards(self):
8281
k = 32
8382
ref_index = faiss.IndexFlatL2(d)
@@ -87,13 +86,6 @@ def test_shards(self):
8786
_Dref, Iref = ref_index.search(xq, k)
8887
print(Iref[:5, :6])
8988

90-
# there is a OpenMP bug in this configuration, so disable threading
91-
if sys.platform == "darwin" and "Clang 12" in sys.version:
92-
nthreads = faiss.omp_get_max_threads()
93-
faiss.omp_set_num_threads(1)
94-
else:
95-
nthreads = None
96-
9789
shard_index = faiss.IndexShards(d)
9890
shard_index_2 = faiss.IndexShards(d, True, False)
9991

@@ -139,8 +131,6 @@ def test_shards(self):
139131
print('%d / %d differences' % (ndiff, nq * k))
140132
assert(ndiff < nq * k / 1000.)
141133

142-
if nthreads is not None:
143-
faiss.omp_set_num_threads(nthreads)
144134

145135
class Merge(unittest.TestCase):
146136

0 commit comments

Comments
 (0)