Skip to content

Commit 9f7f879

Browse files
bhanutejagkBhanu Teja Goshikonda
andauthored
Build cu130 base image with Python 3.13.11, CUDA 13.0.2, and EFA 1.47.0 (#5621)
* Update cu130 base image to Python 3.13.11, CUDA 13.0.2, and EFA 1.46.0 - Update Python version from 3.12.10 to 3.13.11 - Update CUDA version from 13.0.0 to 13.0.2 with driver 580.95.05 - Update EFA version from 1.44.0 to 1.46.0 - Update image tag from py312 to py313 - New image tag: 13.0.2-gpu-py313-cu130-ubuntu22.04-ec2 * Enable base image build for cu130 in developer config - Add 'base' to build_frameworks list - Set dlc-pr-base buildspec to base/buildspec-cu130-ubuntu22.yml * Fix pip symlink for Python installations Add symlinks for 'pip' and 'pip3' to point to version-specific pip. This fixes the test_pip_check failure where pip was not found in PATH. The 'make altinstall' command only creates version-specific binaries (e.g., pip3.13) and does not create generic pip/pip3 symlinks. The script was already creating symlinks for python/python3, but was missing the corresponding pip symlinks. * Revert developer config to default state Reset build_frameworks to empty array and dlc-pr-base buildspec to empty string. This reverts the temporary changes made for testing the base image build. * Add CUDA 13.0.2 base image with updated versions New cu1302 base image configuration: - CUDA: 13.0.2 - Python: 3.13.11 - cuDNN: 9.15.1.9 - NCCL: v2.28.9-1 - EFA: 1.46.0 Changes: - Add new Dockerfile at base/x86_64/gpu/cu1302/ubuntu22.04/ - Add new buildspec base/buildspec-cu1302-ubuntu22.yml - Add install_cuda1302_stack_ul22 function in install_cuda.sh - Revert cu130 Dockerfile to upstream (CUDA 13.0.0) * Enable cu1302 base image build in developer config * Revert buildspec-cu130-ubuntu22.yml to upstream * fix: remove pip symlink lines as pip upgrade already creates them * Reverted toml file to its original state * Reverted back install_python.sh file and building image * Reverted back toml file to its original * Updated EFA version to 1.47 * refactor: reorganize cu130 dockerfiles into py312/py313 subdirectories * Building cu13.0.2 base image * Reverted back toml file * Building cu 13.0.2 image * Reverted back toml file --------- Co-authored-by: Bhanu Teja Goshikonda <bhanugk@amazon.com>
1 parent 5a0e55d commit 9f7f879

File tree

6 files changed

+231
-2
lines changed

6 files changed

+231
-2
lines changed

base/buildspec-cu130-ubuntu22.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ images:
4444
os_version: &OS_VERSION ubuntu22.04
4545
tag: !join [ *VERSION, "-", *DEVICE_TYPE, "-", *TAG_PYTHON_VERSION, "-", *CUDA_VERSION, "-", *OS_VERSION, "-ec2" ]
4646
latest_release_tag: !join [ *VERSION, "-", *DEVICE_TYPE, "-", *TAG_PYTHON_VERSION, "-", *CUDA_VERSION, "-", *OS_VERSION, "-ec2" ]
47-
docker_file: !join [ *FRAMEWORK, /, *ARCH_TYPE, /, *DEVICE_TYPE, /, *CUDA_VERSION, /, *OS_VERSION, /Dockerfile ]
47+
docker_file: !join [ *FRAMEWORK, /, *ARCH_TYPE, /, *DEVICE_TYPE, /, *CUDA_VERSION, /, *OS_VERSION, /, *TAG_PYTHON_VERSION, /Dockerfile ]
4848
target: final
4949
build: true
5050
enable_common_stage_build: false

base/buildspec-cu1302-ubuntu22.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
account_id: &ACCOUNT_ID <set-$ACCOUNT_ID-in-environment>
2+
prod_account_id: &PROD_ACCOUNT_ID 763104351884
3+
region: &REGION <set-$REGION-in-environment>
4+
framework: &FRAMEWORK base
5+
version: &VERSION 13.0.2
6+
short_version: &SHORT_VERSION "13.0"
7+
arch_type: &ARCH_TYPE x86_64
8+
autopatch_build: "False"
9+
10+
repository_info:
11+
base_repository: &BASE_REPOSITORY
12+
image_type: &IMAGE_TYPE gpu
13+
root: .
14+
repository_name: &REPOSITORY_NAME !join [ pr, "-", *FRAMEWORK ]
15+
repository: &REPOSITORY !join [ *ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/, *REPOSITORY_NAME ]
16+
release_repository_name: &RELEASE_REPOSITORY_NAME !join [ *FRAMEWORK ]
17+
release_repository: &RELEASE_REPOSITORY !join [ *PROD_ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/, *RELEASE_REPOSITORY_NAME ]
18+
19+
context:
20+
base_context: &BASE_CONTEXT
21+
deep_learning_container:
22+
source: src/deep_learning_container.py
23+
target: deep_learning_container.py
24+
install_python:
25+
source: scripts/install_python.sh
26+
target: install_python.sh
27+
install_cuda:
28+
source: scripts/install_cuda.sh
29+
target: install_cuda.sh
30+
install_efa:
31+
source: scripts/install_efa.sh
32+
target: install_efa.sh
33+
34+
images:
35+
base_x86_64_gpu_cuda1302_ubuntu22:
36+
<<: *BASE_REPOSITORY
37+
context:
38+
<<: *BASE_CONTEXT
39+
image_size_baseline: 11000
40+
device_type: &DEVICE_TYPE gpu
41+
cuda_version: &CUDA_VERSION cu130
42+
python_version: &DOCKER_PYTHON_VERSION py3
43+
tag_python_version: &TAG_PYTHON_VERSION py313
44+
os_version: &OS_VERSION ubuntu22.04
45+
tag: !join [ *VERSION, "-", *DEVICE_TYPE, "-", *TAG_PYTHON_VERSION, "-", *CUDA_VERSION, "-", *OS_VERSION, "-ec2" ]
46+
latest_release_tag: !join [ *VERSION, "-", *DEVICE_TYPE, "-", *TAG_PYTHON_VERSION, "-", *CUDA_VERSION, "-", *OS_VERSION, "-ec2" ]
47+
docker_file: !join [ *FRAMEWORK, /, *ARCH_TYPE, /, *DEVICE_TYPE, /, *CUDA_VERSION, /, *OS_VERSION, /, *TAG_PYTHON_VERSION, /Dockerfile ]
48+
target: final
49+
build: true
50+
enable_common_stage_build: false
51+
test_configs:
52+
test_platforms:
53+
- sanity
54+
- security

base/buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
buildspec_pointer: buildspec-cu130-ubuntu22.yml
1+
buildspec_pointer: buildspec-cu1302-ubuntu22.yml
File renamed without changes.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
ARG PYTHON="python3"
2+
ARG PYTHON_VERSION="3.13.11"
3+
ARG PYTHON_SHORT_VERSION="3.13"
4+
ARG CUDA_MAJOR="13"
5+
ARG CUDA_MINOR="0"
6+
ARG CUDA_PATCH="2"
7+
ARG EFA_VERSION="1.47.0"
8+
ARG OS_VERSION="ubuntu22.04"
9+
FROM nvidia/cuda:${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}-base-${OS_VERSION} AS base-builder
10+
11+
12+
RUN mv /usr/local/cuda/compat /usr/local \
13+
&& apt-get update \
14+
&& apt-get -y upgrade --only-upgrade systemd \
15+
&& apt-get install -y --allow-change-held-packages --no-install-recommends \
16+
automake \
17+
build-essential \
18+
ca-certificates \
19+
cmake \
20+
curl \
21+
emacs \
22+
git \
23+
jq \
24+
libcurl4-openssl-dev \
25+
libglib2.0-0 \
26+
libegl1 \
27+
libgl1 \
28+
libsm6 \
29+
libssl-dev \
30+
libxext6 \
31+
libxrender-dev \
32+
zlib1g-dev \
33+
unzip \
34+
vim \
35+
wget \
36+
libhwloc-dev \
37+
libgomp1 \
38+
libibverbs-dev \
39+
libnuma1 \
40+
libnuma-dev \
41+
libtool \
42+
openssl \
43+
python3-dev \
44+
autoconf \
45+
pkg-config \
46+
check \
47+
libsubunit0 \
48+
libsubunit-dev \
49+
libffi-dev \
50+
libbz2-dev \
51+
liblzma-dev \
52+
libsqlite3-dev \
53+
&& apt-get autoremove -y \
54+
&& apt-get clean \
55+
&& rm -rf /var/lib/apt/lists/*
56+
57+
##############################################################################
58+
FROM base-builder AS python-builder
59+
ARG PYTHON_VERSION
60+
COPY install_python.sh install_python.sh
61+
RUN bash install_python.sh ${PYTHON_VERSION} && rm install_python.sh
62+
63+
##############################################################################
64+
FROM base-builder AS cuda-builder
65+
ARG CUDA_MAJOR
66+
ARG CUDA_MINOR
67+
ARG CUDA_PATCH
68+
ARG OS_VERSION
69+
COPY install_cuda.sh install_cuda.sh
70+
RUN bash install_cuda.sh "${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}" "${OS_VERSION}" && rm install_cuda.sh
71+
72+
##############################################################################
73+
FROM nvidia/cuda:${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}-base-${OS_VERSION} AS final
74+
ARG PYTHON
75+
ARG PYTHON_SHORT_VERSION
76+
ARG CUDA_MAJOR
77+
ARG CUDA_MINOR
78+
ARG EFA_VERSION
79+
LABEL maintainer="Amazon AI"
80+
LABEL dlc_major_version="1"
81+
ENV DEBIAN_FRONTEND=noninteractive \
82+
LANG=C.UTF-8 \
83+
LC_ALL=C.UTF-8 \
84+
DLC_CONTAINER_TYPE=base \
85+
# Python won't try to write .pyc or .pyo files on the import of source modules
86+
# Force stdin, stdout and stderr to be totally unbuffered. Good for logging
87+
PYTHONDONTWRITEBYTECODE=1 \
88+
PYTHONUNBUFFERED=1 \
89+
PYTHONIOENCODING=UTF-8 \
90+
CUDA_HOME="/usr/local/cuda" \
91+
PATH="/opt/amazon/openmpi/bin:/opt/amazon/efa/bin:/usr/local/cuda/bin:${PATH}" \
92+
LD_LIBRARY_PATH="/usr/local/lib:/usr/local/cuda/lib64:/opt/amazon/ofi-nccl/lib:/opt/amazon/efa/lib:/opt/amazon/openmpi/lib:${LD_LIBRARY_PATH}"
93+
94+
WORKDIR /
95+
96+
# + python and pip packages (awscli, boto3, requests)
97+
COPY --from=python-builder /usr/local/lib/python${PYTHON_SHORT_VERSION} /usr/local/lib/python${PYTHON_SHORT_VERSION}
98+
COPY --from=python-builder /usr/local/include/python${PYTHON_SHORT_VERSION} /usr/local/include/python${PYTHON_SHORT_VERSION}
99+
COPY --from=python-builder /usr/local/bin /usr/local/bin
100+
# + cuda-toolkit, cudnn, nccl
101+
COPY --from=cuda-builder /usr/local/cuda-${CUDA_MAJOR}.${CUDA_MINOR} /usr/local/cuda-${CUDA_MAJOR}.${CUDA_MINOR}
102+
COPY install_efa.sh install_efa.sh
103+
COPY deep_learning_container.py /usr/local/bin/deep_learning_container.py
104+
COPY bash_telemetry.sh /usr/local/bin/bash_telemetry.sh
105+
RUN chmod +x /usr/local/bin/deep_learning_container.py && \
106+
chmod +x /usr/local/bin/bash_telemetry.sh && \
107+
echo 'source /usr/local/bin/bash_telemetry.sh' >> /etc/bash.bashrc && \
108+
# Install EFA
109+
bash install_efa.sh ${EFA_VERSION} && \
110+
rm install_efa.sh && \
111+
# OSS compliance
112+
apt-get update && \
113+
apt-get upgrade -y && \
114+
apt-get install -y --allow-change-held-packages --no-install-recommends \
115+
unzip \
116+
wget && \
117+
apt-get clean && \
118+
HOME_DIR=/root && \
119+
curl -o ${HOME_DIR}/oss_compliance.zip https://aws-dlinfra-utilities.s3.amazonaws.com/oss_compliance.zip && \
120+
unzip ${HOME_DIR}/oss_compliance.zip -d ${HOME_DIR}/ && \
121+
cp ${HOME_DIR}/oss_compliance/test/testOSSCompliance /usr/local/bin/testOSSCompliance && \
122+
chmod +x /usr/local/bin/testOSSCompliance && \
123+
chmod +x ${HOME_DIR}/oss_compliance/generate_oss_compliance.sh && \
124+
${HOME_DIR}/oss_compliance/generate_oss_compliance.sh ${HOME_DIR} ${PYTHON} && \
125+
rm -rf ${HOME_DIR}/oss_compliance* && \
126+
rm -rf /tmp/tmp* && \
127+
rm -rf /var/lib/apt/lists/* && \
128+
rm -rf /root/.cache | true
129+
130+
CMD ["/bin/bash"]

scripts/install_cuda.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,45 @@ function install_cuda130_stack_ul22 {
205205
ldconfig
206206
}
207207

208+
function install_cuda1302_stack_ul22 {
209+
CUDNN_VERSION="9.15.1.9"
210+
NCCL_VERSION="v2.28.9-1"
211+
CUDA_HOME="/usr/local/cuda"
212+
213+
# move cuda-compt and remove existing cuda dir from nvidia/cuda:**.*.*-base-*
214+
rm -rf /usr/local/cuda-*
215+
rm -rf /usr/local/cuda
216+
217+
# install CUDA 13.0.2
218+
wget -q https://developer.download.nvidia.com/compute/cuda/13.0.2/local_installers/cuda_13.0.2_580.95.05_linux.run
219+
chmod +x cuda_13.0.2_580.95.05_linux.run
220+
./cuda_13.0.2_580.95.05_linux.run --toolkit --silent
221+
rm -f cuda_13.0.2_580.95.05_linux.run
222+
ln -s /usr/local/cuda-13.0 /usr/local/cuda
223+
# bring back cuda-compat
224+
mv /usr/local/compat /usr/local/cuda/compat
225+
226+
# install cudnn
227+
mkdir -p /tmp/cudnn
228+
cd /tmp/cudnn
229+
wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION}_cuda13-archive.tar.xz -O cudnn-linux-x86_64-${CUDNN_VERSION}_cuda13-archive.tar.xz
230+
tar xf cudnn-linux-x86_64-${CUDNN_VERSION}_cuda13-archive.tar.xz
231+
cp -a cudnn-linux-x86_64-${CUDNN_VERSION}_cuda13-archive/include/* /usr/local/cuda/include/
232+
cp -a cudnn-linux-x86_64-${CUDNN_VERSION}_cuda13-archive/lib/* /usr/local/cuda/lib64/
233+
234+
# install nccl
235+
mkdir -p /tmp/nccl
236+
cd /tmp/nccl
237+
git clone -b $NCCL_VERSION --depth 1 https://github.com/NVIDIA/nccl.git
238+
cd nccl
239+
make -j src.build
240+
cp -a build/include/* /usr/local/cuda/include/
241+
cp -a build/lib/* /usr/local/cuda/lib64/
242+
243+
prune_cuda
244+
ldconfig
245+
}
246+
208247
# idiomatic parameter and option handling in sh
209248
while test $# -gt 0
210249
do
@@ -228,6 +267,12 @@ do
228267
*) echo "bad OS version $2"; exit 1 ;;
229268
esac
230269
;;
270+
13.0.2)
271+
case "$2" in
272+
"ubuntu22.04") install_cuda1302_stack_ul22 ;;
273+
*) echo "bad OS version $2"; exit 1 ;;
274+
esac
275+
;;
231276
*) echo "bad CUDA version $1"; exit 1 ;;
232277
esac
233278
shift 2 # Skip both arguments at once

0 commit comments

Comments
 (0)