Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ helpers, GitHub Actions matrix converter, reusable workflow, and tests.
│ ├── metax/
│ ├── moore/
│ ├── cambricon/
│ ├── hygon/
│ └── ascend/
└── tests/
```
Expand Down
82 changes: 82 additions & 0 deletions images/hygon/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
ARG BASE_IMAGE=harbor.sourcefind.cn:5443/dcu/admin/base/custom:sglang-deepseek-v4-dev-zkjh
FROM ${BASE_IMAGE}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ENV DEBIAN_FRONTEND=noninteractive

ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY
ARG http_proxy
ARG https_proxy
ARG no_proxy

ARG APT_MIRROR
RUN if [ -n "$APT_MIRROR" ]; then \
sed -i "s|http://[^[:space:]]*/ubuntu|${APT_MIRROR}|g" \
/etc/apt/sources.list \
/etc/apt/sources.list.d/*.sources 2>/dev/null || true; \
fi && \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
clang-format \
cmake \
curl \
git \
libboost-stacktrace-dev \
libclang-dev \
ninja-build \
patchelf \
pkg-config \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

# Keep the DTK-enabled PyTorch supplied by the base image when project
# dependencies are installed later in a development container.
RUN torch_version="$(python3 -m pip show torch | awk '/^Version:/ {print $2}')" && \
test -n "$torch_version" && \
printf 'torch==%s\n' "$torch_version" > /etc/pip-constraints.txt
ENV PIP_CONSTRAINT=/etc/pip-constraints.txt

RUN python3 -m pip install --no-cache-dir \
libclang \
pybind11 \
pytest \
pytest-cov \
pytest-mock \
pytest-xdist \
pyyaml \
ruff==0.15.7 \
scikit-build-core

ARG XMAKE_VERSION=v3.0.5
ARG XMAKE_SHA256=4075ef1b4cba7f5eb5c55a4451761ef081086bb3142e7d4b130cf9c7484e68f0
ARG XMAKE_DOWNLOAD_URL=https://github.com/xmake-io/xmake/releases/download/${XMAKE_VERSION}/xmake-bundle-${XMAKE_VERSION}.linux.x86_64
ENV XMAKE_ROOT=y
RUN curl --retry 5 --retry-all-errors -fsSL \
"${XMAKE_DOWNLOAD_URL}" -o /usr/local/bin/xmake && \
printf '%s %s\n' "$XMAKE_SHA256" /usr/local/bin/xmake \
| sha256sum --check - && \
chmod +x /usr/local/bin/xmake

# Pin the package recipes used by the validated environment and pre-populate
# the Xmake package cache. Otherwise a fresh container resolves a newer Boost
# archive from GitHub and every developer has to download and build it again.
ARG XMAKE_REPO_URL=https://gitee.com/crapromer/xmake-repo.git
ARG XMAKE_REPO_COMMIT=674a71c5905870e6e7e162bf689903822bbbf16e
COPY images/hygon/xmake-cache.lua /opt/xmake-cache-project/xmake.lua
RUN git clone "${XMAKE_REPO_URL}" /opt/xmake-repo && \
git -C /opt/xmake-repo checkout "${XMAKE_REPO_COMMIT}" && \
xmake repo --clear --global && \
xmake repo --add --global xmake-repo /opt/xmake-repo && \
xmake require -y -P /opt/xmake-cache-project

ENV DTK_ROOT=/opt/dtk
ENV HYGON_ARCH=gfx936
ENV CUDA_HOME=/opt/dtk/cuda/cuda
ENV PATH=/opt/dtk/cuda/cuda/bin:/root/.local/bin:${PATH}

WORKDIR /workspace/codes
Loading