Skip to content

Commit 743b193

Browse files
authored
build: update image cuBLAS to 13.8.1 (#6252)
Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
1 parent 7235082 commit 743b193

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

‎docker/Dockerfile.ci‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,30 @@ ENV MBRIDGE_PRESERVE_BASE_RUNTIME=${PRESERVE_BASE_RUNTIME} \
6262
RDMA_CORE_HOME=/opt/rdma-core/build \
6363
LD_LIBRARY_PATH="/usr/local/cuda/lib64/:$LD_LIBRARY_PATH"
6464

65+
ARG TARGETARCH
66+
ARG CUBLAS_VERSION=13.8.1.7
67+
RUN bash -euxo pipefail <<"EOF"
68+
if [ "$MBRIDGE_PRESERVE_BASE_RUNTIME" = "True" ]; then exit 0; fi
69+
# Match the cuBLAS update in NVIDIA/Megatron-LM#7685.
70+
case "${TARGETARCH}" in
71+
amd64) CUBLAS_ARCH=x86_64 ;;
72+
arm64) CUBLAS_ARCH=sbsa ;;
73+
*) echo "Unsupported TARGETARCH for cuBLAS: ${TARGETARCH}" >&2; exit 1 ;;
74+
esac
75+
CUBLAS_ARCHIVE="libcublas-linux-${CUBLAS_ARCH}-${CUBLAS_VERSION}_cuda13-archive"
76+
CUBLAS_TMP=$(mktemp -d)
77+
trap 'rm -rf "${CUBLAS_TMP}"' EXIT
78+
curl -fLSs --retry 3 -o "${CUBLAS_TMP}/cublas.tar.xz" \
79+
"https://developer.download.nvidia.com/compute/cublas/redist/libcublas/linux-${CUBLAS_ARCH}/${CUBLAS_ARCHIVE}.tar.xz"
80+
tar -xJf "${CUBLAS_TMP}/cublas.tar.xz" -C "${CUBLAS_TMP}"
81+
# Replace the toolkit copies so existing linker paths use the updated libraries.
82+
CUDA_ROOT="${CUDA_HOME:-/usr/local/cuda}"
83+
cp -a "${CUBLAS_TMP}/${CUBLAS_ARCHIVE}/include/." "${CUDA_ROOT}/include/"
84+
cp -a "${CUBLAS_TMP}/${CUBLAS_ARCHIVE}/lib/." "${CUDA_ROOT}/lib64/"
85+
install -Dm644 "${CUBLAS_TMP}/${CUBLAS_ARCHIVE}/LICENSE" "${CUDA_ROOT}/doc/cublas/LICENSE"
86+
ldconfig
87+
EOF
88+
6589
##############################################################################
6690
##
6791
## Install DeepEP and nvshmem

‎docker/README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ docker build \
3030
| Argument | Description |
3131
|---|---|
3232
| `BASE_IMAGE` | Base container |
33+
| `CUBLAS_VERSION` | CUDA 13 cuBLAS archive version; defaults to `13.8.1.7` for x86_64 and Arm SBSA |
3334
| `MCORE_TRIGGERED_TESTING` | When `true`, skips the uv lockfile check to allow testing against a different Megatron-LM version than the one pinned in the lockfile |
3435
| `INSTALL_DIFFUSION_DEPS` | When `true`, runs `scripts/install_diffusion_deps.sh` to add WAN codecs to a CI image; defaults to `false` so CVE-carrying codecs stay out of shipped Framework images |
3536
| `UV_CACHE_PRUNE_ARGS` | Extra arguments forwarded to `uv cache prune` after install |
@@ -58,7 +59,7 @@ For a base image with a validated, source-built Transformer Engine/PyTorch pairi
5859
to `Dockerfile.ci`. The default is `False`, preserving the normal installation path.
5960

6061
When enabled, Bridge and FW-final dependency syncs skip installing Transformer
61-
Engine and cuDNN frontend, and Bridge skips its public CUTLASS DSL replacement.
62+
Engine and cuDNN frontend, and Bridge skips its public CUTLASS DSL and cuBLAS replacements.
6263
FW-final inherits the setting from the Bridge image; it does not need a second
6364
build argument. The build records the selected Torch, TE, cuDNN frontend, and
6465
CUTLASS distribution versions and installation locations in
@@ -199,14 +200,15 @@ docker build \
199200
| Argument | Description |
200201
|---|---|
201202
| `BASE_IMAGE` | Base container; set to the fw-base image when building the full stack |
203+
| `CUBLAS_VERSION` | CUDA 13 cuBLAS archive version; defaults to `13.8.1.7`. Installs cuBLAS/cuBLASLt and headers into the existing CUDA toolkit before native dependencies are built; skipped with `PRESERVE_BASE_RUNTIME=True` |
202204
| `APPLY_PYTORCH_LIBRARY_FINALIZER_PATCH` | Set to `True` to apply the torch.library finalizer patch; `False` for base images it does not apply against (e.g. Rubin) |
203205
| `INSTALL_DEEPEP` | Set to `True` to build and install DeepEP and nvshmem |
204206
| `DEEPEP_COMMIT` | DeepEP git commit SHA |
205207
| `REINSTALL_NVSHMEM` | Set to `True` to reinstall nvshmem (`nvidia-nvshmem-cu13`) over the base image version; only applied when `INSTALL_DEEPEP=True` |
206208
| `MCORE_TRIGGERED_TESTING` | Skip uv lockfile check for cross-version Megatron-LM testing |
207209
| `INSTALL_DIFFUSION_DEPS` | Install the test-only WAN diffusion dependencies; defaults to `false` for Framework/release images |
208210
| `UV_CACHE_PRUNE_ARGS` | Extra arguments for `uv cache prune` |
209-
| `PRESERVE_BASE_RUNTIME` | Keep validated base TE/cuDNN frontend/CUTLASS packages and verify package metadata; defaults to `False` |
211+
| `PRESERVE_BASE_RUNTIME` | Keep validated base TE/cuDNN frontend/CUTLASS/cuBLAS packages and verify package metadata; defaults to `False` |
210212

211213
### `Dockerfile.fw_final`
212214

0 commit comments

Comments
 (0)