summaryrefslogtreecommitdiff
path: root/experiments/baseline_sweep.sh
blob: bd3ff7b073eee4107d7a98cf716f9985cda78d18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# Run canonical non-backprop baselines. Method-specific knobs can be appended.
# Usage: baseline_sweep.sh <gpu> "<methods>" "<seeds>" <dataset> <depth> <width> <epochs> <prefix> [extra args...]
set -eu

cd "$(dirname "$0")/.."
PY=/home/yurenh2/miniconda3/envs/ep_pascal/bin/python3
GPU="${1:?GPU index required}"
METHODS="${2:-fa pepita ff ep}"
SEEDS="${3:-0}"
DATASET="${4:-mnist}"
DEPTH="${5:-2}"
WIDTH="${6:-500}"
EPOCHS="${7:-10}"
PREFIX="${8:-canonical}"
shift 8 || true

export CUDA_VISIBLE_DEVICES="$GPU"
export OMP_NUM_THREADS=2
mkdir -p results logs/baselines

for seed in $SEEDS; do
  for method in $METHODS; do
    tag="${PREFIX}_${DATASET}_${method}_w${WIDTH}_d${DEPTH}_s${seed}"
    result="results/${tag}.json"
    log="logs/baselines/${tag}.log"
    if [[ -f "$result" ]]; then
      echo "skip $tag (result exists)"
      continue
    fi
    echo ">>> $tag $(date --iso-8601=seconds) gpu=$GPU"
    "$PY" experiments/baseline_run.py --method "$method" --dataset "$DATASET" \
      --depth "$DEPTH" --width "$WIDTH" --epochs "$EPOCHS" --seed "$seed" \
      --tag "$tag" --outdir results "$@" > "$log" 2>&1
    grep -h DONE "$log"
  done
done