#!/usr/bin/env bash # The MergeBench property sweep: one worker per GPU, each pinned, families smallest-first. # # Properties only -- no merged model is built and nothing is evaluated (RESULTS_MERGEBENCH.md). # Each worker takes every n-th family from the size-ordered list, streams it (download -> measure -> # delete), appends to its own CSV and redraws the figures after each family, so an interrupted run # still leaves a usable figure on disk. Ledger-resumable: relaunching skips finished families. # # bash scripts/run_mergebench.sh 4 5 # EXTRA="--families gemma-2-9b gemma-2-9b-it" bash scripts/run_mergebench.sh 5 set -u cd "$(dirname "$0")/.." PY=${PYTHON:-/root/venvs/mergeability/bin/python} GPUS=("$@"); [ ${#GPUS[@]} -eq 0 ] && GPUS=(4 5) N=${#GPUS[@]} mkdir -p results/mergebench/logs figures/mergebench # Bounded thread pools. The box runs several concurrent agents on 128 cores; left to itself every # numpy/torch process opens a pool per core and they preempt each other -- measured at load ~320 # with 311k threads and the GPUs near 0%. Must be set before python imports numpy. export MB_THREADS=${MB_THREADS:-8} export OMP_NUM_THREADS=$MB_THREADS export MKL_NUM_THREADS=$MB_THREADS export OPENBLAS_NUM_THREADS=$MB_THREADS export NUMEXPR_NUM_THREADS=$MB_THREADS export VECLIB_MAXIMUM_THREADS=$MB_THREADS [ -f /root/.ms_hf_env ] && set -a && . /root/.ms_hf_env && set +a for i in "${!GPUS[@]}"; do g=${GPUS[$i]} HF_HOME=/root/hf_cache_mergebench/w${i} \ CUDA_VISIBLE_DEVICES=$g PYTHONPATH=src \ setsid nohup "$PY" -u -m mergeschool.mergebench.sweep --worker "$i" --n-workers "$N" ${EXTRA:-} \ > "results/mergebench/logs/w${i}_gpu${g}.log" 2>&1 & echo "worker $i -> GPU $g (pid $!)" done sleep 2 echo "logs: results/mergebench/logs/"