Repository navigation
Expand file tree
/
Copy pathDockerfile.base.rhel
More file actions
103 lines (94 loc) · 5.69 KB
/
Copy pathDockerfile.base.rhel
File metadata and controls
103 lines (94 loc) · 5.69 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Reconstructs, from 100% public sources, the manylinux_2_34 (EL9 / glibc 2.34)
# CUDA/cuDNN/TensorRT base image that `build.py --target-platform=rhel` expects but does
# not install itself -- so you can reproduce a RHEL/manylinux Triton build without an
# internal, unpublished base image.
#
# Since 26.08, build.py's rhel path is manylinux-native: it assumes pypa's layout
# (/opt/_internal/cpython-*, the static libpython archive, and the pipx "shared" venv it
# puts first on PATH and uses as pip3/python3) and installs its own build tooling into that
# venv. So we start FROM the pypa image and add only what build.py assumes is already there.
#
# EXAMPLE ONLY -- not officially supported; equivalent, not identical, to the base
# NVIDIA uses for the released manylinux artifacts. See this tutorial's README.
# pypa's manylinux_2_34: AlmaLinux 9 (glibc 2.34), CPython builds under /opt/_internal.
# Pin a dated tag for reproducibility.
ARG BASE_IMAGE=quay.io/pypa/manylinux_2_34_x86_64:2026.09.05-1
FROM ${BASE_IMAGE}
# EPEL + CRB: part of build.py's own `yum install` list (re2-devel, libb64-devel,
# gperftools-devel) lives in EPEL and it assumes the repos are enabled.
RUN set -eux; \
dnf install -y dnf-plugins-core epel-release; \
dnf config-manager --set-enabled crb; \
dnf clean all
# CUDA toolkit (same package set as nvidia/cuda:*-devel), cuDNN and TensorRT from the public
# cuda-rhel9 repo. TENSORRT_VERSION is the rpm's version-release; TensorRT trails CUDA by a
# minor, so a CUDA 13.4 toolkit pairs with a TensorRT built for cuda13.3. cuDNN is installed
# at exactly CUDNN_VERSION, and that value is exported below because ONNX Runtime's build only
# sets cudnn_home=/usr when the variable is set.
ARG CUDA_VERSION=13.4.1
ARG CUDNN_VERSION=9.25.1.1
ARG TENSORRT_VERSION=11.2.1.2-1.cuda13.3
RUN set -eux; \
pkg=$(echo "${CUDA_VERSION}" | awk -F. '{print $1"-"$2}'); \
dnf config-manager --add-repo \
https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo; \
dnf install -y \
cuda-minimal-build-${pkg} cuda-libraries-devel-${pkg} cuda-command-line-tools-${pkg} \
cuda-nvml-devel-${pkg} cuda-nvtx-${pkg} \
libcudnn9-devel-cuda-13-${CUDNN_VERSION} \
"tensorrt-devel-${TENSORRT_VERSION}"; \
dnf clean all
# The environment nvidia/cuda images export (the Triton wheel build reads CUDA_VERSION).
ENV CUDA_VERSION=${CUDA_VERSION} \
CUDNN_VERSION=${CUDNN_VERSION} \
PATH=/usr/local/cuda/bin:${PATH} \
LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} \
LIBRARY_PATH=/usr/local/cuda/lib64/stubs \
NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=compute,utility
# gcc-toolset-13: the compiler NVIDIA's 26.08 manylinux artifacts are built with. EL9's
# rapidjson-devel (1.1.0), which build.py installs, does not compile with GCC 14.
RUN dnf install -y gcc-toolset-13-gcc-c++ gcc-toolset-13-libatomic-devel && dnf clean all
ENV PATH=/opt/rh/gcc-toolset-13/root/usr/bin:${PATH}
# build.py puts /opt/_internal/pipx/shared/bin first on PATH and uses its pip3/python3 for
# everything: its tooling, the Triton wheels, the python backend's runtime interpreter. In
# the stock pypa image that venv belongs to the newest CPython; Triton's RHEL
# build is Python 3.12 (the pytorch backend hardcodes cpython-3.12.x), so recreate it from cp312.
RUN set -eux; \
rm -rf /opt/_internal/pipx/shared; \
/opt/python/cp312-cp312/bin/python -m venv /opt/_internal/pipx/shared; \
/opt/_internal/pipx/shared/bin/pip install --no-cache-dir --upgrade pip
ENV PATH=/opt/_internal/pipx/shared/bin:${PATH}
# Empty libpython for README Step 3's Python_LIBRARY: the core links libpython into its Python
# bindings, which don't need it, and pypa's static libpython can't go into a shared library.
RUN mkdir -p /opt/_internal/nolibpython && ar rcs /opt/_internal/nolibpython/libpython3.12.a
# Fail loudly if a bad pin left a piece missing or the wrong Python on PATH.
RUN set -eux; nvcc --version >/dev/null; g++ --version | head -1 | grep ' 13\.'; \
rpm -q tensorrt-devel libcudnn9-devel-cuda-13; \
python3 --version | grep -q ' 3\.12\.'; pip3 --version; \
test -f /opt/_internal/static-libs-for-embedding-only.tar.xz