#!/bin/bash
#SBATCH -J Validation_case_specfem-small_benchmark_run_to_test_more_complex_Earth
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=24
#SBATCH --time=01:59:59
#SBATCH --output Validation_case_specfem_small_benchmark_run_to_test_more_complex_Earth-%j.out 
#SBATCH -C HSW24

#set -e
source ../env/env_occigen
echo "Environment used:"
echo "================="
cat ../env/env_occigen

cd $install_dir/specfem3d_globe/EXAMPLES/small_benchmark_run_to_test_more_complex_Earth


export SLURM_CPU_BIND=NONE
export I_MPI_PIN=1
#export I_MPI_PIN_PROCESSOR_LIST=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23

time ./run_this_example.sh

echo
echo "running seismogram comparisons:"
echo

cd $install_dir/specfem3d_globe/
# uncompress seismograms
if [ -e EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK/II.AAK.MXE.sem.ascii.bz2 ]; then
  echo
  echo "unzipping references..."
  echo
  mkdir OUTPUT_FILES_reference_OK/
  bunzip2 EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK/*.bz2
  echo
  echo
fi

module purge
module load intel/17.0 python/2.7.13
# compares seismograms by plotting correlations
./utils/compare_seismogram_correlations.py EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES/ EXAMPLES/small_benchmark_run_to_test_more_complex_Earth/OUTPUT_FILES_reference_OK/

echo
echo "done"
echo


