#!/bin/bash -login
#$ -cwd
#$ -pe smp.pe 4
### Run 1000 copies of a job, each numbered 1,...,1000
#$ -t 1-7200

module load tools/env/proxy
module load apps/anaconda3
# Inform numpy how many cores to use. $NSLOTS is automatically set to the number given above.
export OMP_NUM_THREADS=$NSLOTS

CSVFILE=gecco_job_params.csv
# Read line number N (where N is my task number) from a simple plain text .csv file
# SGE_TASK_ID is set to 1 (in task number 1, set to 2 in task number 2, .... - where each task is a separate job)
#
# Note, the "while do done" loop while only execute once. It is needed to make the 'read' command work.
# The read command will be given one line from the csv file (line 1 in task 1, line 2 in task 2, ...). It will then
# read the comma-separated values in to variables named iid, test, interactions, run. But this only works
# in a fake while loop.

sed -n ${SGE_TASK_ID}p $CSVFILE  | while IFS="," read -r iid test mode interactions run; do
  # echo $iid $test $mode $interactions $run; done
  python3 gecco_tests.py ${iid} ${test} ${mode} ${interactions} ${run}
done

# End of jobscript.