forked from thu-pacman/chitu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathascend.a3.Dockerfile
More file actions
78 lines (66 loc) · 3.05 KB
/
ascend.a3.Dockerfile
File metadata and controls
78 lines (66 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# NOTE: CANN version is coupled with torch-npu version.
# See https://github.com/Ascend/pytorch/tags for the mapping.
FROM quay.io/ascend/cann:8.3.rc1.alpha001-a3-ubuntu22.04-py3.11 AS base
ARG optional_deps=''
ARG chitu_setup_jobs=''
ARG enable_cython='true'
ARG enable_test='false'
ENV CHITU_SETUP_JOBS=$chitu_setup_jobs
ENV MAX_JOBS=$CHITU_SETUP_JOBS
RUN if [ "${enable_cython}" != "true" ] && [ "${enable_cython}" != "false" ]; then \
echo "ARG enable_cython must either be 'true' or 'false'"; \
exit 1; \
fi
RUN if [ "${enable_test}" != "true" ] && [ "${enable_test}" != "false" ]; then \
echo "ARG enable_test must either be 'true' or 'false'"; \
exit 1; \
fi
# Required for non-interactive apt install
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN pip install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
# NOTE: Always apt update before apt install to avoid out-dated docker cache
# NOTE: Test dependencies include:
# - pytest is for test/pytest (for all platforms).
# - aiohttp is for service tests (for all platforms).
RUN if [ "${enable_test}" = "true" ]; then \
apt update -y && apt install -y expect vim tmux telnet htop lsof strace iputils-ping && \
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pytest aiohttp; \
fi
RUN apt update -y && apt install -y curl
# Download prometheus
# NOTE: Always download from Github, because docker on our platform does not support mounting secret
RUN mkdir -p /workspace/prometheus && \
case "$(uname -m)" in \
x86_64|amd64) \
GITHUB_URL="https://github.com/prometheus/prometheus/releases/download/v3.9.1/prometheus-3.9.1.linux-amd64.tar.gz" \
;; \
aarch64|arm64) \
GITHUB_URL="https://github.com/prometheus/prometheus/releases/download/v3.9.1/prometheus-3.9.1.linux-arm64.tar.gz" \
;; \
*) \
echo "Unsupport arch: $(uname -m)" && exit 1 \
;; \
esac && \
echo "Download prometheus from GitHub" && \
curl -L --retry 3 --retry-delay 5 -o /workspace/prometheus.tar.gz "${GITHUB_URL}" && \
tar -xzvf /workspace/prometheus.tar.gz --strip-components=1 -C /workspace/prometheus && \
rm -rf /workspace/prometheus.tar.gz && \
cp /workspace/prometheus/prometheus /usr/local/bin && \
cp /workspace/prometheus/promtool /usr/local/bin/ && \
rm -rf /workspace/prometheus && \
prometheus --version
RUN if [ "$(lscpu | grep x86)" ]; then \
pip install -U torch==2.6.0+cpu -i https://download.pytorch.org/whl/cpu; \
else \
pip install -U torch==2.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple; \
fi
RUN pip install pyyaml setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple
WORKDIR /workspace/chitu
COPY ./test ./test
COPY ./script ./script
COPY ./benchmarks ./benchmarks
# Currently, we require a development version of torch-npu to support aclgraph
ENV CHITU_ASCEND_BUILD=1
# The actual installing procedure requries a NPU device, which is not available in the `docker build` stage.
# We delay it to an additional `docker run` stage which runs `script/install.sh`.