diff options
| author | pjotr | 2026-05-29 08:56:56 +0000 |
|---|---|---|
| committer | pjotr | 2026-05-29 08:59:13 +0000 |
| commit | d0a397903a5732560ed5dd354e7dad0789eae1dc (patch) | |
| tree | 3ec208d22c3e2d558149062d1bbffe626b4612e1 | |
| parent | 7069ddc63d1b462fbdb994055dd0006a4f4bc17b (diff) | |
| download | guix-bioinformatics-d0a397903a5732560ed5dd354e7dad0789eae1dc.tar.gz | |
docker
| -rw-r--r-- | scripts/lib-pangenome-pack.sh | 65 |
1 files changed, 60 insertions, 5 deletions
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 <<EOF +TUNE=$TUNE is not supported. Use one of the psABI v-levels: + + 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) + +Microarch names (cascadelake, znver3, ...) are rejected because Go +in the closure only supports the v-levels. +EOF + exit 2 + ;; + esac + ARCH_SLUG="$ARCH-$TUNE" +fi + +cpu_compat () { + case "$TUNE" in + "") printf 'Generic x86_64 -- any 64-bit Intel or AMD CPU (no AVX/AVX2/AVX-512 required).' ;; + x86-64) printf 'Any 64-bit Intel or AMD CPU (psABI baseline, since ~2003).' ;; + x86-64-v2) printf 'Intel Nehalem (1st-gen Core i7) or newer / AMD Bulldozer or newer. Requires SSE4.2 + POPCNT.' ;; + x86-64-v3) printf 'Intel Haswell (4th-gen Core) or newer / AMD Excavator / Zen 1 or newer. Requires AVX2 + BMI1/2 + FMA.' ;; + x86-64-v4) printf 'Intel Skylake-SP / Cascade Lake / Ice Lake / Sapphire Rapids (Xeon Scalable, Core-X 7900X+) / AMD Zen 4 / Zen 5. Requires AVX-512 (F/DQ/CD/BW/VL).' ;; + esac +} # Resolve the exact version each package contributes to the closure. # `guix package -A` is regex-on-name and can be ambiguous (multiple @@ -40,13 +92,14 @@ IMPG_VER=$(resolve_version '(@ (gn packages pangenome-rust) impg)' impg) WFMASH_VER=$(resolve_version '(@ (gn packages pangenome) wfmash-0.14-snapshot)' wfmash) PGGB_VER=$(resolve_version '(@ (gn packages pangenome) pggb)' pggb) -VERSION_STEM="guix-bioinformatics-$GB_HASH-impg-$IMPG_VER-wfmash-$WFMASH_VER-pggb-$PGGB_VER" +VERSION_STEM="$ARCH_SLUG-guix-bioinformatics-$GB_HASH-impg-$IMPG_VER-wfmash-$WFMASH_VER-pggb-$PGGB_VER" pangenome_pack () { fmt="$1" ; ext="$2" ; label="$3" - echo "==> 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" |
