-
Notifications
You must be signed in to change notification settings - Fork 30
/
Dockerfile.gpu
71 lines (50 loc) · 2.54 KB
/
Dockerfile.gpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM nvidia/cuda:10.1-cudnn7-runtime as build-stage
WORKDIR /usr/src/app
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8" PATH="/opt/venv/bin:$PATH" PIP_NO_CACHE_DIR="false" CFLAGS="-mavx2 -mf16c" CXXFLAGS="-mavx2 -mf16c"
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 python3-pip python3-venv python3-dev wget make g++ libblas-dev liblapack-dev swig patch && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN python3 -m venv /opt/venv && \
python3 -m pip install pip==19.3.1 pip-tools==4.2.0 wheel==0.33.6
RUN python3 -m piptools sync
COPY patches .
RUN wget -q https://github.com/facebookresearch/faiss/archive/v1.6.0.tar.gz -O faiss.tar.gz && \
echo "71a47cbb00aa0ae09b77a70d3fa1617bf7861cc7d41936458b88c7a161b03660 faiss.tar.gz" | sha256sum -c && \
tar xf faiss.tar.gz && \
rm faiss.tar.gz && \
cd faiss* && \
ls .. && \
patch -p1 < ../faiss-fix-compilation-for-mavx2.patch && \
patch -p1 < ../faiss-fix-python-module-prints.patch && \
./configure --without-cuda && \
make -j $(nproc) && \
cd python && \
make -j $(nproc) && \
python3 setup.py bdist_wheel && \
cd ../../ && \
python3 -m pip install faiss*/python/dist/faiss*.whl && \
cp faiss*/python/dist/faiss*.whl /opt/ && \
rm -rf faiss*
FROM nvidia/cuda:10.1-cudnn7-runtime as dev-stage
WORKDIR /usr/src/app
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8" PATH="/opt/venv/bin:$PATH" PIP_NO_CACHE_DIR="false"
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 python3-pip python3-venv libglib2.0-0 libblas3 liblapack3 libgomp1 && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN python3 -m venv /opt/venv && \
python3 -m pip install pip==19.3.1 pip-tools==4.2.0
RUN echo "https://download.pytorch.org/whl/cu100/torch-1.3.0%2Bcu100-cp36-cp36m-linux_x86_64.whl \
--hash=sha256:2414744c5f9fc25e4ee181019df188b0ea28c7866ce7af13116c4d7e538460b7 \
\n \
https://download.pytorch.org/whl/cu100/torchvision-0.4.1%2Bcu100-cp36-cp36m-linux_x86_64.whl \
--hash=sha256:6a90d52d88dd2e4bc411b1d6b9bf89521b8727228318bf91832f3961c854622c \
\n" >> requirements.txt
RUN python3 -m piptools sync
COPY --from=build-stage /opt/faiss*.whl /opt
RUN python3 -m pip install /opt/faiss*.whl && \
rm /opt/faiss*.whl
COPY . .
ENTRYPOINT ["/usr/src/app/bin/ig65m"]
CMD ["-h"]