generalRun.sh 2.54 KB
Newer Older
1
2
#!/bin/bash

iker_martin's avatar
iker_martin committed
3
4
#SBATCH --mem-per-cpu=6000
#SBATCH --exclusive
5
6
#SBATCH --exclude=c02,c01,c00
#SBATCH -p P1
7
8
9

# !!!!This script should only be called by others scripts, do not call it directly!!!
# Runs a given configuration file with the indicated parameters with the aid of the RMS Slurm.
10
11
12
13
14
# Parameter 1 - Number of cores in a single machine
# Parameter 2 - Configuration file name for the emulation.
# Parameter 3 - Use Valgrind(1), Extrae(2) or nothing(0).
# Parameter 4 - Index to use for the output files. Must be a positive integer.
# Parameter 5 - Amount of executions per file. Must be a positive number.
15
16
17
#====== Do not modify these values =======

execDir="/Exec"
18
19
20

echo "START TEST"

21
22
23
24
25
#$1 == cores
#$2 == configFile
#$3 == use_external
#$4 == outFileIndex
#$5 == qty
26
27

echo $@
28
if [ $# -lt 3 ]
29
30
31
32
33
then
  echo "Internal ERROR generalRun.sh - Not enough arguments were given"
  exit -1
fi

34
#READ PARAMETERS AND ENSURE CORRECTNESS
35
36
37
38
cores=$1
configFile=$2
use_external=$3
outFileIndex=$4
39
qty=1
40
if [ $# -ge 4 ]
41
then
42
  qty=$5
43
fi
44

45
46
47
48
49
50
nodelist=$SLURM_JOB_NODELIST
if [ -z "$nodelist" ];
then
  echo "Internal ERROR in generalRun.sh - Nodelist not provided"
  exit -1
fi
51

52
53
numP=$(bash $PROTEO_HOME$execDir/BashScripts/getNumPNeeded.sh $configFile 0)
initial_nodelist=$(bash $PROTEO_HOME$execDir/BashScripts/createInitialNodelist.sh $numP $cores $nodelist)
54
55
56

#EXECUTE RUN
echo "Nodes=$nodelist"
57
if [ $use_external -eq 0 ] #NORMAL
58
then
59
60
  for ((i=0; i<qty; i++))
  do
61
    echo "Run $i starts"
62
    mpirun -hosts $initial_nodelist -np $numP $PROTEO_BIN $configFile $outFileIndex
63
    echo "Run $i ends"
64
  done
65
66
elif [ $use_external -eq 1 ] #VALGRIND
then
67
  cp $PROTEO_HOME$execDir/Valgrind/worker_valgrind.sh .
68
69
70
  for ((i=0; i<qty; i++))
  do
    echo "Run $i starts"
71
    mpirun -hosts $initial_nodelist -np $numP valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --trace-children=yes --log-file=vg.sp.%p.$SLURM_JOB_ID.$i $PROTEO_BIN $configFile $outIndex 
72
73
74
    echo "Run $i ends"
  done
else #EXTRAE
75
76
77
  cp $PROTEO_HOME$execDir/Extrae/extrae.xml .
  cp $PROTEO_HOME$execDir/Extrae/trace.sh .
  cp $PROTEO_HOME$execDir/Extrae/worker_extrae.sh .
78
79
80
  for ((i=0; i<qty; i++))
  do
    #FIXME Extrae not tested keeping in mind the initial nodelist - Could have some errors
81
    srun -n$numP --mpi=pmi2 ./trace.sh $PROTEO_BIN $configFile $outFileIndex
82
  done
83
84
85
86
fi

echo "END TEST"
sed -i 's/application called MPI_Abort(MPI_COMM_WORLD, -100) - process/shrink cleaning/g' slurm-$SLURM_JOB_ID.out
87
sed -i 's/Abort(-100)/shrink cleaning/g' slurm-$SLURM_JOB_ID.out
88
89
MAM_ID=$(($SLURM_JOB_ID % 1000))
rm MAM_HF_ID*$MAM_ID*.tmp