|
| 1 | +# |
| 2 | +# First, get the nvidia image, which has the nvidia cuda drivers etc. |
| 3 | +# |
| 4 | +FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu14.04 as base |
| 5 | + |
| 6 | +# |
| 7 | +# Install miniconda into it |
| 8 | +## Copied from continuumio/miniconda:4.3.14 |
| 9 | +# |
| 10 | + |
| 11 | +# Do this here, because it'll be cached |
| 12 | +COPY aquaint+wiki.txt.gz.ndim=50.bin / |
| 13 | + |
| 14 | +RUN echo "13dc26ecb4455cf437e19b6dcf869867 *aquaint+wiki.txt.gz.ndim=50.bin" | md5sum -c - && \ |
| 15 | + apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 git mercurial subversion && \ |
| 16 | + echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ |
| 17 | + wget --quiet https://repo.continuum.io/miniconda/Miniconda3-4.3.14-Linux-x86_64.sh -O ~/miniconda.sh && \ |
| 18 | + /bin/bash ~/miniconda.sh -b -p /opt/conda && \ |
| 19 | + rm ~/miniconda.sh && \ |
| 20 | + apt-get install -y curl grep sed dpkg && \ |
| 21 | + TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \ |
| 22 | + curl -L "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" > tini.deb && \ |
| 23 | + dpkg -i tini.deb && \ |
| 24 | + rm tini.deb |
| 25 | + |
| 26 | +ENV PATH /opt/conda/bin:$PATH |
| 27 | + |
| 28 | +# |
| 29 | +# Then install pytorch, version with/without mkl |
| 30 | +## ORIGINALLY FROM continuumio/miniconda:4.3.14 |
| 31 | +# |
| 32 | +FROM base as pytorch |
| 33 | + |
| 34 | +ARG lib=mkl |
| 35 | +ARG pytorch=0.1.12 |
| 36 | + |
| 37 | +RUN apt install -y build-essential=11.6ubuntu6 && \ |
| 38 | + apt-get clean && \ |
| 39 | + export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" && \ |
| 40 | + conda install -y conda==4.3.25 python==3.6.1 && \ |
| 41 | + if [ "${lib}" = "mkl" ]; then \ |
| 42 | + conda install -y mkl==2017.0.3 mkl-service==1.1.2; \ |
| 43 | + else \ |
| 44 | + conda install -y nomkl==1.0; \ |
| 45 | + fi && \ |
| 46 | + conda install -y numpy==1.13.1 pyyaml==3.12 setuptools==27.2.0 cmake==3.6.3 gcc==4.8.5 cffi==1.10.0 gensim==1.0.1 nltk==3.2.1 scikit-learn==0.18.1 pandas==0.20.3 && \ |
| 47 | + wget https://github.com/pytorch/pytorch/archive/v${pytorch}.tar.gz && \ |
| 48 | + tar xzf v${pytorch}.tar.gz && \ |
| 49 | + cd pytorch-${pytorch} && \ |
| 50 | + python setup.py install |
| 51 | + |
| 52 | +ENV OMP_NUM_THREADS=1 |
| 53 | +ENV MKL_NUM_THREADS=1 |
| 54 | + |
| 55 | +# |
| 56 | +# And now get the repositories, with `castor` at a given sha sum |
| 57 | +# |
| 58 | +FROM pytorch |
| 59 | + |
| 60 | +ARG sha=171fee4 |
| 61 | + |
| 62 | +RUN git clone https://github.com/castorini/castor /castorini/castor && \ |
| 63 | + git clone https://github.com/castorini/data /castorini/data && \ |
| 64 | + git -C /castorini/castor reset --hard ${sha} && \ |
| 65 | + git -C /castorini/data reset --hard 42abddd && \ |
| 66 | + mv /aquaint+wiki.txt.gz.ndim=50.bin /castorini/data/word2vec && \ |
| 67 | + cd /castorini/data/TrecQA && \ |
| 68 | + python parse.py && \ |
| 69 | + python overlap_features.py && \ |
| 70 | + python build_vocab.py && \ |
| 71 | + cd /castorini/castor/sm_cnn/trec_eval-8.0 && \ |
| 72 | + make |
| 73 | + |
| 74 | +WORKDIR /castorini/castor/sm_cnn |
0 commit comments