docker: derive build.sh's arch-list banner from the Dockerfile

The banner printed before the build hardcoded a second copy of the CUDA
arch list, and it had already drifted: it showed

    8.0;8.6;8.9;9.0;10.0;12.0+PTX

while the Dockerfile builds with

    7.5;8.0;8.6;8.9;9.0;10.0;12.0+PTX

so anyone reading build.sh's output was told Turing is not covered when
in fact it is. The echo does not feed the build, so no image was ever
wrong; only the report was.

Read the value back out of the Dockerfile instead of repeating it. The
sed anchors on an optional-leading-whitespace assignment, so the
Dockerfile's explanatory comment mentioning the same variable is not
matched, and head -n1 takes the builder-stage ENV. Verified to yield
7.5;8.0;8.6;8.9;9.0;10.0;12.0+PTX against the current Dockerfile.
This commit is contained in:
Daniel Han 2026-07-26 15:48:02 +00:00
commit a05c58b6bb

View file

@ -41,7 +41,12 @@ echo " CUDA ${CUDA_VERSION} Ubuntu ${UBUNTU_VERSION} Python ${PYTHO
echo " unsloth @${UNSLOTH_REF}"
echo " unsloth-zoo @${UNSLOTH_ZOO_REF}"
echo " llama.cpp ${LLAMA_PREBUILT_TAG}"
echo " arch list 8.0;8.6;8.9;9.0;10.0;12.0+PTX"
# Read the arch list back out of the Dockerfile rather than repeating it: the
# hand-copied banner had already drifted, dropping 7.5 and so under-reporting
# Turing support to anyone reading this output.
ARCH_LIST="$(sed -n 's/^[[:space:]]*TORCH_CUDA_ARCH_LIST="\([^"]*\)".*/\1/p' \
"$(dirname "$0")/Dockerfile" | head -n1)"
echo " arch list ${ARCH_LIST:-unknown}"
echo
DOCKER_BUILDKIT=1 docker build \