#!/bin/bash
#SBATCH --time=$times:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --mem=$memoryg
#SBATCH --job-name=$job
#SBATCH --output=$job_%j.out
#SBATCH --error=$job_%j.err
#SBATCH --account=$account
#SBATCH --array=1-$workers

export TASKQUEUE_RESOURCE="petrichor"
tic=`date +%s`
echo "Start Time = "`date`

cd $working_dir
echo "working directory = "$working_dir
module load R/4.3.1
module load postgresql/16.0
#module load openmpi

ulimit -s unlimited


echo "Launching script using R"

#mpirun $R_HOME/library/snow/RMPISNOW --no-save --no-restore < $rfile > $rout.Rout
Rscript $rcode > $rout.Rout

echo "All Done!"

echo "End Time = "`date`
toc=`date +%s`

elapsedTime=`expr $toc - $tic`
echo "Elapsed Time = $elapsedTime seconds"


