1010# https://docs.docker.com/develop/develop-images/build_enhancements/
1111
1212ARG BASE_IMAGE=ubuntu:20.04
13- ARG PYTHON_VERSION=3.8
14-
1513FROM ${BASE_IMAGE} AS dev-base
1614RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \
1715 apt-get update && \
1816 DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
19- fakeroot \
2017 ca-certificates \
21- dpkg-dev \
22- g++ \
2318 git \
2419 curl \
2520 vim \
2621 build-essential \
2722 ccache \
2823 libjemalloc-dev \
24+ numactl \
2925 cmake \
3026 libjpeg-dev \
3127 libpng-dev \
@@ -35,6 +31,7 @@ RUN mkdir /opt/ccache && ccache --set-config=cache_dir=/opt/ccache
3531ENV PATH /opt/conda/bin:$PATH
3632
3733FROM dev-base as conda
34+ ARG PYTHON_VERSION=3.8
3835RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
3936 chmod +x ~/miniconda.sh && \
4037 ~/miniconda.sh -b -p /opt/conda && \
@@ -45,22 +42,28 @@ RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Mini
4542FROM dev-base AS build
4643COPY --from=conda /opt/conda /opt/conda
4744ARG TORCHVISION_VERSION=0.6
48- RUN pip install torchvision==${TORCHVISION_VERSION}+cpu --no-deps -f https://download.pytorch.org/whl/torch_stable.html && \
49- pip install lark-parser hypothesis && git clone https://github.com/intel/intel-extension-for-pytorch \
50- && cd intel-extension-for-pytorch && git submodule sync && git submodule update --init --recursive \
51- && git clone https://github.com/pytorch/pytorch \
52- && cd pytorch && git checkout v1.5.0-rc3 && git submodule sync && git submodule update --init --recursive \
53- && git apply ../torch_patches/dpcpp-v1.5-rc3.patch \
54- && USE_MKLDNN=1 USE_CUDA=0 USE_CUDNN=0 CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" python setup.py install \
55- && cd .. && python setup.py install && rm -rf *
45+ RUN --mount=type=cache,target=/opt/ccache \
46+ pip install torchvision==${TORCHVISION_VERSION}+cpu --no-deps \
47+ -f https://download.pytorch.org/whl/torch_stable.html && \
48+ pip install lark-parser hypothesis && \
49+ git clone https://github.com/intel/intel-extension-for-pytorch && \
50+ cd intel-extension-for-pytorch && git submodule sync && \
51+ git submodule update --init --recursive && \
52+ git clone https://github.com/pytorch/pytorch && \
53+ cd pytorch && git checkout v1.5.1 && git submodule sync && \
54+ git submodule update --init --recursive && \
55+ git apply ../torch_patches/dpcpp-v1.5.1.patch && \
56+ USE_MKLDNN=1 USE_CUDA=0 USE_NNPACK=0 USE_CUDNN=0 \
57+ CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" pip install -v . && \
58+ cd .. && pip install -v . && rm -rf *
5659
5760FROM dev-base as dev
5861COPY --from=build /opt/conda /opt/conda
5962ARG OMP_NUM_THREADS=1
6063ENV OMP_NUM_THREADS ${OMP_NUM_THREADS}
6164ARG KMP_BLOCKTIME=1
6265ENV KMP_BLOCKTIME ${KMP_BLOCKTIME}
63- ARG KMP_AFFINITY= "granularity=fine,compact,1,0"
64- ENV KMP_AFFINITY ${KMP_AFFINITY }
66+ ARG KMP_HW_SUBSET=1T
67+ ENV KMP_HW_SUBSET ${KMP_HW_SUBSET }
6568ENV MALLOC_CONF "oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:-1,muzzy_decay_ms:-1"
6669ENV LD_PRELOAD "/opt/conda/lib/libiomp5.so /usr/lib/x86_64-linux-gnu/libjemalloc.so"
0 commit comments