Skip to content

Commit cbb133a

Browse files
committed
add pytorch repo/ add rocm 6.3.4
1 parent f9b57c6 commit cbb133a

File tree

9 files changed

+160
-29
lines changed

9 files changed

+160
-29
lines changed

checkpoint.sh

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,8 @@ fi
1010
TAG_NAME=$(git_get_current_tag)
1111
if [ "$TAG_NAME" == "" ]; then
1212
TAG_NAME="$(date +%Y%m%d%H%M%S)"
13-
TAG_COMMENT="$(
14-
echo "Release $TAG_NAME"
15-
echo "Checkpoints:"
16-
echo "- ROCm: $ROCM_VERSION"
17-
echo "- ComfyUI: $COMFYUI_GIT_REF"
18-
echo "- llama.cpp: $LLAMA_GIT_REF"
19-
)"
20-
git tag -a "$TAG_NAME" -m "$TAG_COMMENT"
21-
echo -e "New tag $TAG_NAME:\n$TAG_COMMENT"
13+
git tag -a "$TAG_NAME"
14+
echo -e "New tag $TAG_NAME" -m "none"
2215
else
2316
echo "Commit already tagged with $TAG_NAME"
2417
fi
25-
26-
git push origin "$TAG_NAME"
27-
#git push origin
28-
29-
pushd rocm
30-
./build-and-push.rocm.sh
31-
popd
32-
33-
pushd llama.cpp
34-
./build-and-push.rocm.sh
35-
./build-and-push.vulkan.sh
36-
popd
37-
38-
pushd comfyui
39-
./build-and-push.comfyui.sh
40-
popd
41-
42-
pushd vllm
43-
./build-and-push.vllm.sh
44-
popd

env.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ source $(dirname ${BASH_SOURCE[0]})/rocm/env.sh
4242
source $(dirname ${BASH_SOURCE[0]})/llama.cpp/env.sh
4343
source $(dirname ${BASH_SOURCE[0]})/comfyui/env.sh
4444
source $(dirname ${BASH_SOURCE[0]})/vllm/env.sh
45+
source $(dirname ${BASH_SOURCE[0]})/pytorch/env.sh

pytorch/build-and-push.torch.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#/bin/bash
2+
set -e
3+
4+
cd $(dirname $0)
5+
source ../env.sh
6+
7+
IMAGE_TAGS=(
8+
"$TORCH_IMAGE:${TORCH_VERSION}-rocm-${TORCH_ROCM_VERSION}-${REPO_GIT_REF}"
9+
"$TORCH_IMAGE:${TORCH_VERSION}-rocm-${TORCH_ROCM_VERSION}"
10+
)
11+
12+
if docker_image_pushed ${IMAGE_TAGS[0]}; then
13+
echo "${IMAGE_TAGS[0]} already in registry. Skip"
14+
exit 0
15+
fi
16+
17+
DOCKER_EXTRA_ARGS=()
18+
for (( i=0; i<${#IMAGE_TAGS[@]}; i++ )); do
19+
DOCKER_EXTRA_ARGS+=("-t" "${IMAGE_TAGS[$i]}")
20+
done
21+
22+
mkdir ./logs || true
23+
docker buildx build ${DOCKER_EXTRA_ARGS[@]} --push \
24+
--build-arg BASE_ROCM_IMAGE="${PATCHED_ROCM_IMAGE}:${TORCH_ROCM_VERSION}-complete" \
25+
--build-arg ROCM_ARCH="${ROCM_ARCH}" \
26+
--build-arg PYTORCH_BRANCH=$TORCH_BRANCH \
27+
--build-arg PYTORCH_VISION_BRANCH=$TORCH_VISION_BRANCH \
28+
--target final -f ./torch.Dockerfile --progress=plain ./submodules 2>&1 | tee ./logs/build_$(date +%Y%m%d%H%M%S).log

pytorch/env.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#/bin/bash
2+
3+
pushd $(dirname ${BASH_SOURCE[0]})
4+
5+
# rocm version
6+
if [ "$TORCH_ROCM_VERSION" == "" ]; then TORCH_ROCM_VERSION=6.3.3; fi
7+
# torch git checkpoint
8+
if [ "$TORCH_PYTORCH_BRANCH" == "" ]; then TORCH_PYTORCH_BRANCH="v2.7.1"; fi
9+
# vision git checkpoint
10+
if [ "$TORCH_PYTORCH_VISION_BRANCH" == "" ]; then TORCH_PYTORCH_VISION_BRANCH="v0.21.0"; fi
11+
12+
# destination image
13+
if [ "$TORCH_IMAGE" == "" ]; then
14+
TORCH_IMAGE=docker.io/mixa3607/pytorch-gfx906
15+
fi
16+
17+
popd
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
export TORCH_ROCM_VERSION="6.3.4"
4+
export TORCH_PYTORCH_BRANCH="v2.7.1"
5+
export TORCH_PYTORCH_VISION_BRANCH="v0.21.0"

pytorch/readme.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# PyTorch GFX906
2+
Tensors and Dynamic neural networks in Python with strong GPU acceleration.
3+
4+
Packages:
5+
- torch
6+
- torchvision
7+
8+
Recommend use `docker.io/mixa3607/pytorch-gfx906:v2.7.1-rocm-6.3.3`
9+
10+
## Build
11+
See build vars in `./env.sh`. You also may use presetis `./preset.*.sh`. Exec `./build-and-push.torch.sh`:
12+
```bash
13+
$ . preset.torch-2.7.1-rocm-6.3.3.sh
14+
$ ./build-and-push.torch.sh
15+
~/REPOS/mixa3607/llama.cpp-gfx906/rocm ~/REPOS/mixa3607/llama.cpp-gfx906/rocm
16+
~/REPOS/mixa3607/llama.cpp-gfx906/rocm
17+
~/REPOS/mixa3607/llama.cpp-gfx906/llama.cpp ~/REPOS/mixa3607/llama.cpp-gfx906/rocm
18+
~/REPOS/mixa3607/llama.cpp-gfx906/rocm
19+
~/REPOS/mixa3607/llama.cpp-gfx906/comfyui ~/REPOS/mixa3607/llama.cpp-gfx906/rocm
20+
~/REPOS/mixa3607/llama.cpp-gfx906/rocm
21+
~/REPOS/mixa3607/llama.cpp-gfx906/vllm ~/REPOS/mixa3607/llama.cpp-gfx906/rocm
22+
~/REPOS/mixa3607/llama.cpp-gfx906/rocm
23+
#0 building with "remote" instance using remote driver
24+
25+
#1 [internal] load build definition from rocm.Dockerfile
26+
#1 transferring dockerfile: 4.95kB done
27+
#1 DONE 0.0s
28+
29+
#2 [auth] dockerio-proxy/rocm/dev-ubuntu-24.04:pull rocm/dev-ubuntu-24.04:pull token for registry.arkprojects.space
30+
#2 DONE 0.0s
31+
32+
#3 [internal] load metadata for docker.io/rocm/dev-ubuntu-24.04:7.0-complete
33+
#3 DONE 1.8s
34+
35+
#4 [internal] load .dockerignore
36+
#4 transferring context: 2B done
37+
#...............
38+
#24 exporting to image
39+
#24 pushing layers 6.5s done
40+
#24 pushing manifest for docker.io/mixa3607/rocm-gfx906:7.0.0-20251005035204-complete@sha256:00532f62462e80d51e48b021afb7875af53164455c84dc28b24eb29d39aa0005
41+
#24 pushing manifest for docker.io/mixa3607/rocm-gfx906:7.0.0-20251005035204-complete@sha256:00532f62462e80d51e48b021afb7875af53164455c84dc28b24eb29d39aa0005 3.3s done
42+
#24 pushing layers 2.0s done
43+
#24 pushing manifest for docker.io/mixa3607/rocm-gfx906:7.0.0-complete@sha256:00532f62462e80d51e48b021afb7875af53164455c84dc28b24eb29d39aa0005
44+
#24 pushing manifest for docker.io/mixa3607/rocm-gfx906:7.0.0-complete@sha256:00532f62462e80d51e48b021afb7875af53164455c84dc28b24eb29d39aa0005 2.2s done
45+
#24 DONE 17.6s
46+
```

pytorch/submodules/.gitkeep

Whitespace-only changes.

pytorch/torch.Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
ARG BASE_ROCM_IMAGE="docker.io/mixa3607/vllm-gfx906:latest"
2+
ARG ROCM_ARCH="gfx906"
3+
ARG PYTORCH_REPO="https://github.com/pytorch/pytorch.git"
4+
ARG PYTORCH_BRANCH="v2.7.1"
5+
ARG PYTORCH_VISION_REPO="https://github.com/pytorch/vision.git"
6+
ARG PYTORCH_VISION_BRANCH="v0.21.0"
7+
8+
############# Base image #############
9+
FROM ${BASE_ROCM_IMAGE} AS rocm_base
10+
# Install basic utilities and Python 3.12
11+
RUN apt-get update && apt-get install -y software-properties-common git python3-pip && \
12+
add-apt-repository ppa:deadsnakes/ppa && \
13+
apt-get update -y && \
14+
apt-get install -y python3.12 python3.12-dev python3.12-venv \
15+
python3.12-lib2to3 python-is-python3 python3.12-full && \
16+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 && \
17+
update-alternatives --set python3 /usr/bin/python3.12 && \
18+
ln -sf /usr/bin/python3.12-config /usr/bin/python3-config && \
19+
python3 -m pip config set global.break-system-packages true && \
20+
pip install amdsmi==$(cat /opt/ROCM_VERSION_FULL) && \
21+
true
22+
23+
# Set environment variables
24+
ARG ROCM_ARCH
25+
ENV ROCM_ARCH=$ROCM_ARCH
26+
ENV PYTORCH_ROCM_ARCH=$ROCM_ARCH
27+
ENV PATH=/opt/rocm/llvm/bin:$PATH
28+
ENV ROCM_PATH=/opt/rocm
29+
ENV LD_LIBRARY_PATH=/opt/rocm/lib:/usr/local/lib:
30+
31+
############# Build torch + vision #############
32+
FROM rocm_base AS build_torch
33+
RUN pip install setuptools wheel packaging cmake ninja setuptools_scm jinja2
34+
35+
ARG PYTORCH_REPO
36+
ARG PYTORCH_BRANCH
37+
RUN ls -la /opt/
38+
RUN git clone --depth 1 --recurse-submodules --shallow-submodules --jobs 4 --branch ${PYTORCH_BRANCH} ${PYTORCH_REPO} pytorch
39+
RUN cd pytorch && pip install -r requirements.txt
40+
RUN cd pytorch && \
41+
python3 tools/amd_build/build_amd.py && \
42+
CMAKE_PREFIX_PATH=$(python3 -c 'import sys; print(sys.prefix)') python3 setup.py bdist_wheel --dist-dir=/dist && \
43+
pip install /dist/*.whl
44+
45+
ARG PYTORCH_VISION_REPO
46+
ARG PYTORCH_VISION_BRANCH
47+
RUN git clone --depth 1 --recurse-submodules --shallow-submodules --jobs 4 --branch ${PYTORCH_VISION_BRANCH} ${PYTORCH_VISION_REPO} vision
48+
RUN cd vision && python3 setup.py bdist_wheel --dist-dir=/dist \
49+
&& pip install /dist/*.whl
50+
51+
############# Install all #############
52+
FROM rocm_base AS final
53+
RUN --mount=type=bind,from=build_torch,src=/dist/,target=/dist_torch \
54+
pip install /dist_torch/*.whl && \
55+
true
56+
57+
CMD ["/bin/bash"]

rocm/preset.rocm-6.3.4.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
export ROCM_VERSION="6.3.4"
4+
export ROCM_IMAGE_VER="6.3.4"

0 commit comments

Comments
 (0)