Skip to content

Commit 9d65c96

Browse files
committed
Merge branch 'ups_master'
2 parents 8f17e9a + be14676 commit 9d65c96

File tree

3 files changed

+836
-0
lines changed

3 files changed

+836
-0
lines changed

docker/Dockerfile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# syntax = docker/dockerfile:experimental
2+
# based onhttps://github.com/pytorch/pytorch/blob/master/Dockerfile
3+
#
4+
# NOTE: To build this you will need a docker version > 18.06 with
5+
# experimental enabled and DOCKER_BUILDKIT=1
6+
#
7+
# If you do not use buildkit you are not going to have a good time
8+
#
9+
# For reference:
10+
# https://docs.docker.com/develop/develop-images/build_enhancements/
11+
12+
ARG BASE_IMAGE=ubuntu:20.04
13+
FROM ${BASE_IMAGE} AS dev-base
14+
RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \
15+
apt-get update && \
16+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
17+
ca-certificates \
18+
git \
19+
curl \
20+
vim \
21+
build-essential \
22+
ccache \
23+
libjemalloc-dev \
24+
numactl \
25+
cmake \
26+
libjpeg-dev \
27+
libpng-dev \
28+
&& rm -rf /var/lib/apt/lists/*
29+
RUN /usr/sbin/update-ccache-symlinks
30+
RUN mkdir /opt/ccache && ccache --set-config=cache_dir=/opt/ccache
31+
ENV PATH /opt/conda/bin:$PATH
32+
33+
FROM dev-base as conda
34+
ARG PYTHON_VERSION=3.8
35+
RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
36+
chmod +x ~/miniconda.sh && \
37+
~/miniconda.sh -b -p /opt/conda && \
38+
rm ~/miniconda.sh && \
39+
/opt/conda/bin/conda install -y python=${PYTHON_VERSION} conda-build pyyaml numpy ipython mkl mkl-include ninja cython typing pybind11 Pillow && \
40+
/opt/conda/bin/conda clean -ya
41+
42+
FROM dev-base AS build
43+
COPY --from=conda /opt/conda /opt/conda
44+
ARG TORCHVISION_VERSION=0.6
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 *
59+
60+
FROM dev-base as dev
61+
COPY --from=build /opt/conda /opt/conda
62+
ARG OMP_NUM_THREADS=1
63+
ENV OMP_NUM_THREADS ${OMP_NUM_THREADS}
64+
ARG KMP_BLOCKTIME=1
65+
ENV KMP_BLOCKTIME ${KMP_BLOCKTIME}
66+
ARG KMP_HW_SUBSET=1T
67+
ENV KMP_HW_SUBSET ${KMP_HW_SUBSET}
68+
ENV MALLOC_CONF "oversize_threshold:1,background_thread:true,metadata_thp:auto,dirty_decay_ms:-1,muzzy_decay_ms:-1"
69+
ENV LD_PRELOAD "/opt/conda/lib/libiomp5.so /usr/lib/x86_64-linux-gnu/libjemalloc.so"

docker/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Use docker
2+
3+
* Notes
4+
5+
If you use linux kernerl under version 5.4 in host, upgrade it.
6+
7+
* How to build image
8+
9+
Run the following commands.
10+
11+
```console
12+
$ cd $DOCKERFILE_DIR
13+
$ DOCKER_BUILDKIT=1 docker build -t intel-extension-for-pytorch:test .
14+
```

0 commit comments

Comments
 (0)