38 lines
1.1 KiB
Docker
38 lines
1.1 KiB
Docker
ARG ROCM_VERSION="5.7.3"
|
|
|
|
FROM wtongze/rocm-base:${ROCM_VERSION}
|
|
|
|
ARG PYTORCH_BRANCH="v2.4.1"
|
|
ARG PYTHON_VERSION="3.11"
|
|
ARG HIP_ARCH="gfx803;gfx900"
|
|
ARG DEBIAN_FRONTEND="noninteractive"
|
|
|
|
# Add GPU target
|
|
RUN echo "${HIP_ARCH}" | sed 's/;/\n/g' | sudo tee /opt/rocm/bin/target.lst
|
|
|
|
WORKDIR /home/rocm
|
|
RUN git clone --depth 1 https://github.com/pytorch/pytorch.git -b ${PYTORCH_BRANCH} pytorch
|
|
WORKDIR /home/rocm/pytorch
|
|
RUN git submodule update --init --recursive
|
|
|
|
RUN <<EOF
|
|
sudo apt-get update
|
|
sudo apt install -y software-properties-common
|
|
sudo add-apt-repository -y ppa:deadsnakes/ppa
|
|
sudo apt-get update
|
|
sudo apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev
|
|
sudo apt-get clean
|
|
sudo rm -rf /var/lib/apt/lists/*
|
|
EOF
|
|
|
|
RUN python${PYTHON_VERSION} -m pip install typing-extensions wheel
|
|
|
|
ENV PYTORCH_ROCM_ARCH=${HIP_ARCH}
|
|
RUN python${PYTHON_VERSION} tools/amd_build/build_amd.py && USE_ROCM=1 python${PYTHON_VERSION} setup.py bdist_wheel
|
|
|
|
WORKDIR /home/rocm/pytorch/dist
|
|
RUN cp (ls -l *.whl | awk '{ print $9 }' | tail -n1 | tr -d '\n') /home/rocm/pytorch-rocm.whl
|
|
|
|
WORKDIR /home/rocm
|
|
CMD [ "bash", "-l" ]
|