#!/bin/bash

#SBATCH -J IC1-ddxc       # Job name
#SBATCH -o ddxc-binning.%j.out      # Name of stdout output file (%j expands to jobId)
#SBATCH -N 1                  # Total number of nodes requested
#SBATCH -n 1                  # Total number of mpi tasks requested
#SBATCH -c 4                  # number of cpus required per task
# #SBATCH --mail-user=ignis@postech.ac.kr
# #SBATCH --mail-type=NONE

# Launch MPI-based executable

if [ -n "$SLURM_CPUS_PER_TASK" ]; then
  omp_threads=$SLURM_CPUS_PER_TASK
else
  omp_threads=1
fi
export MKL_NUM_THREADS=$omp_threads
export OMP_NUM_THREADS=$omp_threads
export OPENBLAS_NUM_THREADS=$omp_threads

echo $OMP_NUM_THREADS / $XINDEX / $SLURM_ARRAY_TASK_ID

if [ -n "$SLURM_ARRAY_TASK_ID" ]; then
  echo Using Array Task ID
  XINDEX=$SLURM_ARRAY_TASK_ID
elif [ -n "$XINDEX" ]; then
  echo XINDEX given explicitly
else
  echo ERROR: XINDEX Required
fi


echo python /home/ignis/dns/CNF2021-Figures/binning_v_given_c.py -x $XINDEX -v $BIN_TARGET
time python /home/ignis/dns/CNF2021-Figures/binning_v_given_c.py -x $XINDEX -v $BIN_TARGET
