#!/bin/bash
#SBATCH -J camels
#SBATCH --nodes=1 --ntasks-per-node=40
#SBATCH --constraint=skylake
#SBATCH --exclusive
#SBATCH --time=167:00:00
#SBATCH -o OUTPUT.o%j
#SBATCH -e OUTPUT.e%j
#SBATCH -p cca

module load gcc
module load openmpi
module load lib/fftw2/2.1.5-openmpi1
module load lib/gsl

#Remove outputs from previous runs 
# rm -f test_output.dat

/mnt/home/vpandya/rockstar-galaxies_dm/rockstar-galaxies -c /mnt/ceph/users/vpandya/rockstar_camels_tng/par2.cfg &> server.dat &

perl -e 'sleep 1 while (!(-e "/mnt/ceph/users/vpandya/rockstar_camels_tng/auto-rockstar.cfg"))'


mpirun /mnt/home/vpandya/rockstar-galaxies_dm/rockstar-galaxies -c auto-rockstar.cfg >> test_output.dat 2>&1

sleep 10

mpirun /mnt/home/vpandya/rockstar-galaxies_dm/rockstar-galaxies -c auto-rockstar.cfg >> test_output.dat 2>&1

#Finish
