generalRun.sh 2.53 KB
Newer Older
1
2
3
4
#!/bin/bash

#SBATCH --exclude=c02,c01,c00
#SBATCH -p P1
5
6
7
8
9
10

# !!!!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.
# Parameter 1 - Base directory of the malleability benchmark
# Parameter 2 - Number of cores in a single machine
# Parameter 3 - Configuration file name for the emulation.
11
# Parameter 4 - Use Valgrind(1), Extrae(2) or nothing(0).
12
13
14
15
# Parameter 5 - Index to use for the output files. Must be a positive integer.
# Parameter 6 - Amount of executions per file. Must be a positive number.
#====== Do not modify these values =======

16
codeDir="/Codes/build"
17
18
execDir="/Exec"
ResultsDir="/Results"
19
20
21
22

echo "START TEST"

#$1 == baseDir
23
24
#$2 == cores
#$3 == configFile
25
#$4 == use_external
26
27
#$5 == outFileIndex
#$6 == qty
28
29

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

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

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

55
56
57
58
59
numP=$(bash $dir$execDir/BashScripts/getNumPNeeded.sh $configFile 0)
initial_nodelist=$(bash $dir$execDir/BashScripts/createInitialNodelist.sh $numP $cores $nodelist)

#EXECUTE RUN
echo "Nodes=$nodelist"
60
if [ $use_external -eq 0 ] #NORMAL
61
then
62
63
  for ((i=0; i<qty; i++))
  do
64
    echo "Run $i starts"
65
    mpirun -hosts $initial_nodelist -np $numP $dir$codeDir/a.out $configFile $outFileIndex
66
    echo "Run $i ends"
67
  done
68
69
70
71
72
73
74
75
76
77
elif [ $use_external -eq 1 ] #VALGRIND
then
  cp $dir$execDir/Valgrind/worker_valgrind.sh .
  for ((i=0; i<qty; i++))
  do
    echo "Run $i starts"
    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 $dir$codeDir/a.out $configFile $outIndex 
    echo "Run $i ends"
  done
else #EXTRAE
78
79
  cp $dir$execDir/Extrae/extrae.xml .
  cp $dir$execDir/Extrae/trace.sh .
80
  cp $dir$execDir/Extrae/worker_extrae.sh .
81
82
83
  for ((i=0; i<qty; i++))
  do
    #FIXME Extrae not tested keeping in mind the initial nodelist - Could have some errors
84
    srun -n$numP --mpi=pmi2 ./trace.sh $dir$codeDir/a.out $configFile $outFileIndex
85
  done
86
87
88
89
fi

echo "END TEST"
sed -i 's/application called MPI_Abort(MPI_COMM_WORLD, -100) - process/shrink cleaning/g' slurm-$SLURM_JOB_ID.out
90
sed -i 's/Abort(-100)/shrink cleaning/g' slurm-$SLURM_JOB_ID.out