#!/bin/bash
# submit_schnet.bsub ,  SchNet (invariant ENN) on QM9 scalar targets only
#
# SchNet is invariant by construction; we only run it on scalar targets.
# Job array index 1..12 = (target × seed) for 4 scalar targets × 3 seeds.

#BSUB -J starg_schnet[1-12]
#BSUB -o logs/schnet_%I_%J.out
#BSUB -e logs/schnet_%I_%J.err
#BSUB -q normal
#BSUB -n 8
#BSUB -gpu "num=1:mode=exclusive_process"
#BSUB -W 12:00
#BSUB -M 64GB

set -uo pipefail
mkdir -p logs results

TARGETS=(gap alpha mu zpve)
SEEDS=(0 1 2)
TARGET="${TARGETS[$(( (LSB_JOBINDEX - 1) / 3 ))]}"
SEED="${SEEDS[$(( (LSB_JOBINDEX - 1) % 3 ))]}"

WORKDIR=$HOME/starg/python/large_scale
QM9_DIR=${QM9_DIR:-/u/$USER/data/qm9/dsgdb9nsd}

cd "$WORKDIR"
export PYTHONPATH=".:${PYTHONPATH:-}"

echo "[$(date)] host=$(hostname) array=$LSB_JOBINDEX target=$TARGET seed=$SEED"
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader || true

python3 train_baseline_schnet.py \
    --target  "$TARGET" \
    --qm9_dir "$QM9_DIR" \
    --seed    "$SEED" \
    --out_dir results/ \
    --device  cuda

echo "[$(date)] done"
