From d0a397903a5732560ed5dd354e7dad0789eae1dc Mon Sep 17 00:00:00 2001 From: pjotr Date: Fri, 29 May 2026 08:56:56 +0000 Subject: docker --- scripts/lib-pangenome-pack.sh | 65 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/lib-pangenome-pack.sh b/scripts/lib-pangenome-pack.sh index 35c50f7..efc5281 100644 --- a/scripts/lib-pangenome-pack.sh +++ b/scripts/lib-pangenome-pack.sh @@ -23,6 +23,58 @@ mkdir -p "$DEST_DIR" DATE=$(date +%Y%m%d) GB_HASH=$(git -C "$CHANNEL_DIR" rev-parse --short=8 HEAD) +# The pack is built for the host architecture (no cross-compile). +# Embed it in the filename so x86_64 / aarch64 / ... images cannot +# be confused. Optional TUNE env var passes through to +# `guix pack --tune=...` and is appended to the arch slug. +# +# Only the psABI v-levels are accepted as TUNE values: +# +# x86-64 baseline (any 64-bit Intel/AMD CPU) +# x86-64-v2 Nehalem / Bulldozer (SSE4.2 + POPCNT) +# x86-64-v3 Haswell / Zen 1 (AVX2 + BMI1/2 + FMA) +# x86-64-v4 Skylake-SP / Zen 4 (AVX-512 F/DQ/CD/BW/VL) +# +# Microarch names like `cascadelake`, `znver3`, `skylake-avx512` +# are NOT accepted: Go (which the closure pulls in via odgi etc.) +# only understands the v-levels and `guix pack --tune=cascadelake` +# fails with "compiler go@... does not support micro-architecture +# cascadelake". Pick the v-level whose feature set is implied by +# your target microarch (e.g. Cascade Lake/Zen 4 -> v4 because +# both have AVX-512). +ARCH=$(uname -m) +ARCH_SLUG="$ARCH" +TUNE="${TUNE:-}" +if [ -n "$TUNE" ]; then + case "$TUNE" in + x86-64|x86-64-v2|x86-64-v3|x86-64-v4) : ;; + *) + cat >&2 < building $fmt pack from $CHANNEL_DIR" + echo "==> building $fmt pack from $CHANNEL_DIR${TUNE:+ (tune=$TUNE)}" extra="" [ "$fmt" = "docker" ] && extra="--entry-point=/bin/bash --image-tag=pangenome-tools:$GB_HASH" + [ -n "$TUNE" ] && extra="$extra --tune=$TUNE" # shellcheck disable=SC2086 STORE_PATH=$(guix pack -f "$fmt" --no-offload \ -L "$CHANNEL_DIR" \ @@ -83,7 +136,7 @@ pangenome_write_outputs () { # Inventory is identical regardless of pack format -- name it # by channel hash + date only. - INVENTORY="$DEST_DIR/pangenome-tools-guix-bioinformatics-$GB_HASH-$DATE.md" + INVENTORY="$DEST_DIR/pangenome-tools-$ARCH_SLUG-guix-bioinformatics-$GB_HASH-$DATE.md" TOOLS_TSV=$(mktemp) CLEAN_TSV=$(mktemp) trap 'rm -f "$TMP" "$TOOLS_TSV" "$CLEAN_TSV"' EXIT @@ -128,9 +181,11 @@ SCM dashes () { printf '%*s' "$1" '' | tr ' ' -; } { - echo "# pangenome-tools $DATE (guix-bioinformatics @ $GB_HASH)" + echo "# pangenome-tools $DATE ($ARCH_SLUG, guix-bioinformatics @ $GB_HASH)" + echo + echo "Built from \`mempang-workshop\` in guix-bioinformatics @ $GB_HASH for $ARCH_SLUG." echo - echo "Built from \`mempang-workshop\` in guix-bioinformatics @ $GB_HASH." + echo "**CPU compatibility:** $(cpu_compat)" echo printf "| %-${NAME_W}s | %-${VER_W}s | %-${DESC_W}s |\n" \ "Tool" "Version" "Description" -- cgit 1.4.1