-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refine Dockerfile to support both cpu and xpu platform (#981)
* refine Dockerfile to support both cpu and xpu Signed-off-by: Liu, Kaixuan <[email protected]> * nice code Signed-off-by: Liu, Kaixuan <[email protected]> * fix CI issue Signed-off-by: Liu, Kaixuan <[email protected]> * rename Dockerfile.intel to Dockerfile.ipex Signed-off-by: Liu, Kaixuan <[email protected]> * upgrade ipex to 2.5 version; replace extra-index-url Signed-off-by: Liu, Kaixuan <[email protected]> --------- Signed-off-by: Liu, Kaixuan <[email protected]>
- Loading branch information
1 parent
d01af16
commit 847adbc
Showing
3 changed files
with
77 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
ARG PLATFORM=cpu | ||
|
||
FROM ubuntu:22.04 as cpu | ||
WORKDIR /usr/src/ | ||
RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \ | ||
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
git \ | ||
curl \ | ||
vim \ | ||
build-essential \ | ||
ccache \ | ||
libgoogle-perftools-dev \ | ||
numactl \ | ||
cmake \ | ||
libjpeg-dev \ | ||
pybind11-dev \ | ||
libpng-dev \ | ||
python3 \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/*" | ||
RUN /usr/sbin/update-ccache-symlinks | ||
RUN mkdir /opt/ccache && ccache --set-config=cache_dir=/opt/ccache | ||
|
||
ARG IPEX_VERSION=2.5.0 | ||
ARG PYTORCH_VERSION=2.5.1 | ||
ARG TORCHVISION_VERSION=0.20.1+cpu | ||
ARG TORCHAUDIO_VERSION=2.5.1+cpu | ||
|
||
RUN python3 -m pip install --no-cache-dir \ | ||
torch==${PYTORCH_VERSION}+cpu \ | ||
torchvision==${TORCHVISION_VERSION} \ | ||
torchaudio==${TORCHAUDIO_VERSION} \ | ||
--index-url https://download.pytorch.org/whl/cpu && \ | ||
python3 -m pip install intel-openmp -f https://download.pytorch.org/whl/torch_stable.html && \ | ||
python3 -m pip install intel-extension-for-pytorch==$IPEX_VERSION && \ | ||
python3 -m pip install oneccl_bind_pt --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/cpu/cn/ && \ | ||
python3 -m pip install --no-cache-dir py-libnuma | ||
|
||
ARG KMP_BLOCKTIME=1 | ||
ENV KMP_BLOCKTIME=${KMP_BLOCKTIME} | ||
ARG KMP_HW_SUBSET=1T | ||
ENV KMP_HW_SUBSET=${KMP_HW_SUBSET} | ||
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc.so" | ||
|
||
FROM intel/intel-extension-for-pytorch:2.3.110-xpu as xpu | ||
WORKDIR /usr/src/ | ||
|
||
RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \ | ||
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
git \ | ||
curl \ | ||
vim \ | ||
ccache \ | ||
libgoogle-perftools-dev \ | ||
numactl \ | ||
libjpeg-dev \ | ||
pybind11-dev \ | ||
libpng-dev \ | ||
&& rm -rf /var/lib/apt/lists/*" | ||
RUN wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --dearmor | tee /usr/share/keyrings/intel-graphics.gpg > /dev/null | ||
|
||
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | ||
| gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list | ||
|
||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt install -y intel-basekit xpu-smi cmake ninja-build pciutils | ||
|
||
FROM ${PLATFORM} | ||
|
||
COPY optimum optimum | ||
COPY Makefile setup.cfg setup.py pyproject.toml README.md ./ | ||
RUN pip install . |
This file was deleted.
Oops, something went wrong.