Buckets:

soixantesept's picture
download
raw
2.83 kB
#!/usr/bin/env bash
# Build one paq8px variant from the pinned source. Usage:
# ./build_variant.sh <name> <mode> mode: dyn_O3 | dyn_Os | static_Os | static_O3
# Records compile peak RSS (~/usr/bin/time -v) into $B6/out/build/<name>.time and the ELF into
# $B6/out/build/<name>. Only one variant is ever built at a time (memory discipline).
set -uo pipefail
B6=/root/hutter67/swarm67/B6-bundle
src=$B6/work/paq8px-src
out=$B6/out/build
mkdir -p "$out" "$out/obj-$1"
name=$1; mode=$2
cd "$src" || exit 1
zlib_flags='-DNDEBUG -I/root/hutter67/swarm67/B6-bundle/work/paq8px-src/zlib/ -fno-fast-math -ffp-contract=off -fexceptions -include unistd.h'
base='-DNDEBUG -I/root/hutter67/swarm67/B6-bundle/work/paq8px-src/zlib/ -fno-rtti -std=gnu++17 -ffp-contract=off -fno-fast-math'
size_flags='-ffunction-sections -fdata-sections -Wl,--gc-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -Wl,-s'
hard_flags='-fno-stack-protector -fno-plt -fno-threadsafe-statics -fvisibility=hidden -fvisibility-inlines-hidden -fno-semantic-interposition -fmerge-all-constants -fno-ident -Wl,--build-id=none -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed'
case $mode in
dyn_O3) opt='-O3 -flto=2 -funroll-loops -ftree-vectorize -Wl,-s'; link='' ;;
dyn_Os) opt="-Os -flto=2 $size_flags"; link="" ;;
dyn_Os_hard) opt="-Os -flto=2 $size_flags $hard_flags"; link="" ;;
dyn_O2) opt="-O2 -flto=2 -Wl,-s -ffunction-sections -fdata-sections -Wl,--gc-sections -fno-unwind-tables -fno-asynchronous-unwind-tables"; link="" ;;
dyn_Os_flto1) opt="-Os -flto=1 $size_flags"; link="" ;;
dyn_Os_noflto) opt="-Os $size_flags"; link="" ;;
static_Os) opt="-Os $size_flags"; link='-static' ;;
static_O3) opt='-O3 -flto=2 -funroll-loops -ftree-vectorize -Wl,-s'; link='-static' ;;
dyn_Oz_clang) CXX=clang++-17; opt="-Oz $size_flags"; link='' ;;
*) echo "unknown mode $mode" >&2; exit 2 ;;
esac
CXX=${CXX:-g++}
zobjs=()
for c in adler32 crc32 deflate gzlib inffast inflate inftrees trees zutil; do
gcc -c $zlib_flags -Os /root/hutter67/swarm67/B6-bundle/work/paq8px-src/zlib/$c.c -o "$out/obj-$name/$c.o" || exit 3
zobjs+=("$out/obj-$name/$c.o")
done
/usr/bin/time -v -o "$out/$name.time" \
$CXX $base $opt $link -I/root/hutter67/swarm67/B6-bundle/work/paq8px-src/zlib/ "${zobjs[@]}" \
src/file/*.cpp src/filter/*.cpp src/model/*.cpp src/text/*.cpp src/lstm/*.cpp src/*.cpp \
-o "$out/$name" >"$out/$name.buildlog" 2>&1
rc=$?
echo "build rc=$rc"
awk '/Maximum resident set size|Elapsed \(wall clock\)/ {print}' "$out/$name.time" 2>/dev/null
if [[ $rc -eq 0 && -f $out/$name ]]; then
strip --strip-all "$out/$name" -o "$out/$name.stripped" && mv "$out/$name.stripped" "$out/$name"
ls -l "$out/$name"; sha256sum "$out/$name"
file "$out/$name" | cut -c1-200
else
tail -20 "$out/$name.buildlog"
fi
exit $rc

Xet Storage Details

Size:
2.83 kB
·
Xet hash:
cb78ea4299070fbc86c1c6f8dca8c5088d62080212b13cebf06084d00661659e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.