File size: 2,407 Bytes
6d1bbc7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Submit CT LLM Gemini jobs SEQUENTIALLY to avoid 250 RPD contention.
#
# The free tier only allows 250 requests/day. Running 16 jobs concurrently
# means each gets ~15 RPD (useless). Sequential gives each job the full
# 250 RPD quota. The benchmark script auto-resumes from existing predictions.
#
# Order: smallest tasks first (L3=160 → L4=400 → L2=400 → L1=900)
# Expected timeline at 250 RPD: ~30 days total
#
# Usage:
#   bash slurm/submit_ct_gemini_sequential.sh [--dry-run]

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SBATCH="/opt/ohpc/pub/software/slurm/24.05.2/bin/sbatch"
SLURM_TMPL="${SCRIPT_DIR}/run_ct_llm_gemini.slurm"

DRY_RUN=false
if [[ "${1:-}" == "--dry-run" ]]; then
    DRY_RUN=true
    echo "=== DRY RUN ==="
fi

MODEL="gemini-2.5-flash"

# Job list: smallest tasks first for fastest partial results
# Format: TASK CONFIG FS
JOBS=(
    "ct-l3 zero-shot 0"
    "ct-l3 3-shot 0"
    "ct-l3 3-shot 1"
    "ct-l3 3-shot 2"
    "ct-l4 zero-shot 0"
    "ct-l4 3-shot 0"
    "ct-l4 3-shot 1"
    "ct-l4 3-shot 2"
    "ct-l2 zero-shot 0"
    "ct-l2 3-shot 0"
    "ct-l2 3-shot 1"
    "ct-l2 3-shot 2"
    "ct-l1 zero-shot 0"
    "ct-l1 3-shot 0"
    "ct-l1 3-shot 1"
    "ct-l1 3-shot 2"
)

PREV_JOBID=""
TOTAL=0

for entry in "${JOBS[@]}"; do
    read -r TASK CONFIG FS <<< "$entry"
    JOB_NAME="ct_${TASK}_${MODEL}_${CONFIG}_fs${FS}"
    TOTAL=$((TOTAL + 1))

    if $DRY_RUN; then
        if [[ -n "$PREV_JOBID" ]]; then
            echo "  [DRY] $JOB_NAME (after job $PREV_JOBID)"
        else
            echo "  [DRY] $JOB_NAME (first job)"
        fi
        PREV_JOBID="DRY_${TOTAL}"
    else
        DEP_FLAG=""
        if [[ -n "$PREV_JOBID" ]]; then
            DEP_FLAG="--dependency=afterany:${PREV_JOBID}"
        fi

        JOBID=$($SBATCH \
            --job-name="$JOB_NAME" \
            --parsable \
            $DEP_FLAG \
            --export="ALL,TASK=$TASK,MODEL=$MODEL,CONFIG=$CONFIG,FS=$FS" \
            "$SLURM_TMPL")

        echo "  Submitted: $JOB_NAME$JOBID (dep: ${PREV_JOBID:-none})"
        PREV_JOBID="$JOBID"
    fi
done

echo ""
echo "Total jobs: $TOTAL (sequential chain)"
if $DRY_RUN; then
    echo "(Dry run — no jobs submitted)"
    echo "Estimated time at 250 RPD: ~30 days"
else
    echo "Chain started. Each job runs after the previous completes."
    echo "Monitor: squeue -u \$USER | grep gemini"
fi