@@ -22,29 +22,32 @@ RUN apt update && \
2222 wget \
2323 vim \
2424 numactl \
25+ google-perftools \
26+ openssh-server \
27+ net-tools \
2528 gcc-12 \
2629 g++-12 \
27- python3 \
28- python3-dev \
29- python3-pip \
3030 make
31- RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 && \
32- update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 && \
33- update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100 && \
34- update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100 && \
35- update-alternatives --install /usr/bin/python python /usr/bin/python3 100
3631RUN apt clean && \
3732 rm -rf /var/lib/apt/lists/* && \
3833 if [ -f /etc/apt/apt.conf.d/proxy.conf ]; then rm /etc/apt/apt.conf.d/proxy.conf; fi
34+ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 && \
35+ update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 && \
36+ update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100 && \
37+ update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100
3938
4039WORKDIR /root
41- ENV PATH=/root/.local/bin:${PATH}
40+
41+ RUN curl -fsSL -v -o miniforge.sh -O https://github.com/conda-forge/miniforge/releases/download/24.7.1-2/Miniforge3-24.7.1-2-Linux-x86_64.sh && \
42+ bash miniforge.sh -b -p ./miniforge3 && \
43+ rm miniforge.sh
4244
4345FROM base AS dev
4446COPY . ./intel-extension-for-pytorch
4547RUN cp ./intel-extension-for-pytorch/scripts/compile_bundle.sh ./ && \
4648 sed -i "s/VER_IPEX=.*/VER_IPEX=/" compile_bundle.sh
47- RUN CC=gcc CXX=g++ bash compile_bundle.sh && \
49+ RUN . ~/miniforge3/bin/activate && conda create -y -n compile_py310 python=3.10 && conda activate compile_py310 && \
50+ CC=gcc CXX=g++ bash compile_bundle.sh && \
4851 cd intel-extension-for-pytorch && \
4952 VER_TORCH=$(python tools/dep_ver_utils.py -f dependency_version.json -k pytorch:version) && \
5053 VER_TORCHVISION=$(python tools/dep_ver_utils.py -f dependency_version.json -k torchvision:version) && \
@@ -53,11 +56,33 @@ RUN CC=gcc CXX=g++ bash compile_bundle.sh && \
5356 echo ${VER_TORCH} | grep "dev" > /dev/null; TORCH_DEV=$?; URL_NIGHTLY=""; if [ ${TORCH_DEV} -eq 0 ]; then URL_NIGHTLY="nightly/"; fi; echo "#!/bin/bash\npython -m pip install torch==${VER_TORCH} torchvision==${VER_TORCHVISION} torchaudio==${VER_TORCHAUDIO} --index-url https://download.pytorch.org/whl/${URL_NIGHTLY}cpu" > torch_install.sh
5457
5558FROM base AS deploy
56- COPY --from=dev /root/intel-extension-for-pytorch/dist ./wheels
59+ COPY --from=dev /root/intel-extension-for-pytorch/dist ./wheels/
60+ COPY --from=dev /root/torch-ccl/dist ./wheels/
5761COPY --from=dev /root/torch_install.sh .
58- RUN bash ./torch_install.sh && rm ./torch_install.sh && \
62+ RUN cd /usr/lib/x86_64-linux-gnu/ && ln -s libtcmalloc.so.4 libtcmalloc.so && cd && \
63+ . ~/miniforge3/bin/activate && conda create -y -n py310 python=3.10 && conda activate py310 && \
64+ bash ./torch_install.sh && rm ./torch_install.sh && \
5965 python -m pip install ./wheels/*.whl && \
60- python -m pip install intel-openmp==2024.1.2 && \
66+ python -m pip install intel-openmp && \
6167 python -m pip cache purge && \
62- rm -rf ./wheels && \
63- echo "echo \"**Note:** For better performance, please consider to launch workloads with command 'ipexrun'.\"" >> ./.bashrc
68+ rm -rf ./wheels
69+ ARG PORT_SSH=22
70+ RUN mkdir /var/run/sshd && \
71+ sed -i "s/#Port.*/Port ${PORT_SSH}/" /etc/ssh/sshd_config && \
72+ echo "service ssh start" >> /root/.bashrc && \
73+ ssh-keygen -b 4096 -f /root/.ssh/id_rsa -N "" && \
74+ mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
75+ echo "Host *\n Port ${PORT_SSH}\n IdentityFile /root/.ssh/id_rsa\n StrictHostKeyChecking no" > /root/.ssh/config
76+ EXPOSE ${PORT_SSH}
77+ RUN ENTRYPOINT=/usr/local/bin/entrypoint.sh && \
78+ echo "#!/bin/bash" > ${ENTRYPOINT} && \
79+ echo "CMDS=(); while [ \$# -gt 0 ]; do CMDS+=(\$1); shift; done;" >> ${ENTRYPOINT} && \
80+ echo "CMD=\"\"; for i in \${!CMDS[@]}; do CMD=\"\${CMD} \${CMDS[\$i]}\"; done;" >> ${ENTRYPOINT} && \
81+ echo ". ~/miniforge3/bin/activate" >> ${ENTRYPOINT} && \
82+ echo "conda activate py310" >> ${ENTRYPOINT} && \
83+ echo "TMP=\$(python -c \"import torch; import os; print(os.path.abspath(os.path.dirname(torch.__file__)))\")" >> ${ENTRYPOINT} && \
84+ echo ". \${TMP}/../oneccl_bindings_for_pytorch/env/setvars.sh" >> ${ENTRYPOINT} && \
85+ echo "echo \"**Note:** For better performance, please consider to launch workloads with command 'ipexrun'.\"" >> ${ENTRYPOINT} && \
86+ echo "exec \${CMD}" >> ${ENTRYPOINT} && \
87+ chmod +x ${ENTRYPOINT}
88+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
0 commit comments