docker: fix build.sh's arch-list read for relative invocations

a05c58b6b read the arch list back out of the Dockerfile with
"$(dirname "$0")/Dockerfile", but build.sh already does
cd "$(dirname "$0")" near the top. The dirname is therefore applied
twice, so every invocation by a path other than ./build.sh from inside
docker/ died before reaching docker build:

    $ bash wt_r5748/docker/build.sh
    sed: can't read wt_r5748/docker/Dockerfile: No such file or directory
    EXIT=2

set -euo pipefail turns the sed failure into an abort, so this broke the
whole script rather than just the banner it was meant to print.

Use a bare filename, which is what the rest of the script already does
(the docker build context below is a bare "."). Verified from the
workspace root, from an absolute path, and from docker/ itself: all
three now print

    arch list      7.5;8.0;8.6;8.9;9.0;10.0;12.0+PTX
This commit is contained in:
Daniel Han 2026-07-26 17:30:21 +00:00
commit 18260a2729

View file

@ -44,8 +44,10 @@ echo " llama.cpp ${LLAMA_PREBUILT_TAG}"
# 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.
# Bare filename: the script cd'd to its own directory above, so $0's dirname
# would be applied a second time and break every relative invocation.
ARCH_LIST="$(sed -n 's/^[[:space:]]*TORCH_CUDA_ARCH_LIST="\([^"]*\)".*/\1/p' \
"$(dirname "$0")/Dockerfile" | head -n1)"
Dockerfile | head -n1)"
echo " arch list ${ARCH_LIST:-unknown}"
echo