#!/bin/bash
#SBATCH -p long
#SBATCH -t 10:00:00
#SBATCH --mem-per-cpu=4G
#SBATCH --array=1-1000

export PATH=/workspace/software/R-3.6.1/bin:$PATH
module load R/R-3.6.1

mkdir -p output
mkdir -p all/{baseball,mpg,solder}
mkdir -p other/{baseball,mpg,solder}

for df in data/bbdata.txt data/mpgdata.txt data/solder.data
do
    export DATA_FILE=$df

    R CMD BATCH --no-save --no-restore all_ss.R output/$SLURM_ARRAY_TASK_ID.out $SLURM_ARRAY_TASK_ID
    rm *.out

    R CMD BATCH --no-save --no-restore other_ss.R output/$SLURM_ARRAY_TASK_ID.out $SLURM_ARRAY_TASK_ID
    rm *.out
done

