Skip to content

Commit 5c7655b

Browse files
committed
Enhance Dockerfile to install CSP NCCL network plugins for AWS and GCP. Added installation steps for Google's gIB plugin and updated the NCCL versioning. Ensured compatibility with different architectures and improved initialization script handling.
Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
1 parent 6124fbe commit 5c7655b

2 files changed

Lines changed: 96 additions & 4 deletions

File tree

docker/Dockerfile.fw_base

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,44 @@ RUN --mount=type=bind,from=vllm_wheel,source=/src/vllm/,target=/tmp/vllm/ \
134134

135135
##############################################################################
136136
##
137-
## Reinstall the aws-ofi-nccl EFA plugin
137+
## Install CSP NCCL network plugins
138138
##
139139
## NVIDIA PyTorch >= 26.06 dropped aws-ofi-nccl and defaults
140140
## NCCL_NET_PLUGIN=spcx (HPCX Spectrum-X), which cannot drive EFA -> NCCL falls
141141
## back to TCP sockets on AWS. Rebuild the plugin against the reinstalled NCCL and
142-
## the image's libfabric so EFA jobs keep their fabric. Selection stays per-CSP in
143-
## the launcher (EKSEnvPlugin pins NCCL_NET_PLUGIN for AWS). Kept last so it does
144-
## not invalidate the CUDA-toolkit or vLLM layer caches.
142+
## the image's libfabric so EFA jobs keep their fabric. Also install Google's gIB
143+
## plugin for GCP A3 Ultra+ instances. Kept last so these plugins are built against
144+
## the final NCCL and do not invalidate the CUDA-toolkit or vLLM layer caches.
145145
##############################################################################
146146

147147
ARG AWS_OFI_NCCL_VERSION=v1.17.3
148+
ARG GCP_NCCL_PLUGINS_VERSION=1.1.2
149+
ARG TARGETARCH
148150

149151
RUN --mount=type=bind,source=docker/common/install_aws_ofi_nccl.sh,target=/opt/install_aws_ofi_nccl.sh \
150152
bash /opt/install_aws_ofi_nccl.sh --AWS_OFI_NCCL_VER=$AWS_OFI_NCCL_VERSION
151153

154+
RUN set -euxo pipefail && \
155+
case "${TARGETARCH}" in amd64|arm64) ;; *) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1;; esac && \
156+
mkdir -p /etc/apt/keyrings && \
157+
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg \
158+
-o /etc/apt/keyrings/cloud-google.asc && \
159+
echo "deb [signed-by=/etc/apt/keyrings/cloud-google.asc] https://packages.cloud.google.com/apt gpudirect-gib-apt main" \
160+
> /etc/apt/sources.list.d/nccl-gib.list && \
161+
apt-get update && \
162+
apt-get install -y --no-install-recommends \
163+
"nccl-gcp-plugins-ngc=${GCP_NCCL_PLUGINS_VERSION}-*" && \
164+
test -f /opt/gcp/nccl-plugins/lib64/libnccl-net-gcp.so && \
165+
echo "/opt/gcp/nccl-plugins/lib64" > /etc/ld.so.conf.d/gcp-nccl-plugins.conf && \
166+
rm -f /etc/apt/sources.list.d/nccl-gib.list /etc/apt/keyrings/cloud-google.asc && \
167+
rm -rf /var/lib/apt/lists/* && \
168+
ldconfig
169+
170+
RUN --mount=type=bind,source=docker/common/gcp_nccl_init.sh,target=/opt/gcp_nccl_init.sh \
171+
install -m 0644 /opt/gcp_nccl_init.sh /etc/gcp_nccl_init.sh && \
172+
{ grep -qxF '. /etc/gcp_nccl_init.sh' /etc/shinit_v2 || \
173+
echo '. /etc/gcp_nccl_init.sh' >> /etc/shinit_v2; }
174+
152175
##############################################################################
153176
##
154177
## Final layer of FW_BASE container

docker/common/gcp_nccl_init.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#!/bin/sh
16+
17+
# GCP detection: try multiple independent signals because newer machine types
18+
# do not expose SMBIOS to the guest, so the DMI path alone misses them.
19+
_is_gcp_host() {
20+
# gVNIC driver bound to at least one PCI device.
21+
for _d in /sys/bus/pci/drivers/gve/*:*; do
22+
[ -e "$_d" ] && return 0
23+
done
24+
# Any PCI device with Google's vendor ID.
25+
for _v in /sys/bus/pci/devices/*/vendor; do
26+
[ -r "$_v" ] && [ "$(cat "$_v")" = "0x1ae0" ] && return 0
27+
done
28+
# SMBIOS fallback for machine families that expose it.
29+
[ "$(cat /sys/class/dmi/id/product_name 2>/dev/null)" = "Google Compute Engine" ] && return 0
30+
[ "$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)" = "Google" ] && return 0
31+
return 1
32+
}
33+
34+
# Only gIB-capable GCP instance families expose mlx5 RDMA NICs.
35+
_has_nvidia_rdma_nic() {
36+
for _d in /sys/bus/pci/drivers/mlx5_core/*:*; do
37+
[ -e "$_d" ] && return 0
38+
done
39+
return 1
40+
}
41+
42+
if _is_gcp_host && _has_nvidia_rdma_nic && \
43+
[ -f /opt/gcp/nccl-plugins/lib64/libnccl-net-gcp.so ]; then
44+
export NCCL_NET_PLUGIN=gcp
45+
if [ -f /opt/gcp/nccl-plugins/lib64/libnccl-tuner-gcp.so ]; then
46+
export NCCL_TUNER_PLUGIN=gcp
47+
fi
48+
if [ -f /opt/gcp/nccl-plugins/lib64/libnccl-profiler-gcp.so ]; then
49+
export NCCL_PROFILER_PLUGIN=gcp
50+
fi
51+
if [ -f /opt/gcp/nccl-plugins/lib64/libnccl-env-gcp.so ]; then
52+
export NCCL_ENV_PLUGIN=gcp
53+
fi
54+
if [ -d /opt/gcp/nccl-plugins/configs ]; then
55+
export NCCL_TUNER_CONFIG_PATH=/opt/gcp/nccl-plugins/configs
56+
fi
57+
fi
58+
59+
if [ "${NCCL_PROFILER_PLUGIN:-}" = gcp ]; then
60+
echo
61+
echo "NOTE: GCP NCCL telemetry enabled."
62+
echo " See https://docs.cloud.google.com/ai-hypercomputer/docs/nccl/comma"
63+
echo " for further information."
64+
fi
65+
66+
unset -f _is_gcp_host
67+
unset -f _has_nvidia_rdma_nic
68+
unset _d
69+
unset _v

0 commit comments

Comments
 (0)