generalRunCostum.sh 2.16 KB
Newer Older
1
2
3
4
#!/bin/bash

# !!!!This script should only be called by others scripts, do not call it directly!!!
# Runs a given configuration file with the indicated parameters.
5
6
7
8
9
# Parameter 1 - Number of cores in a single machine
# Parameter 2 - Configuration file name for the emulation.
# Parameter 3 - Use Extrae(1) or not(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.
10
11
12
13
14
15
#====== Do not modify these values =======

execDir="/Exec"

echo "START TEST"

16
17
18
19
20
#$1 == cores
#$2 == configFile
#$3 == use_external
#$4 == outFileIndex
#$5 == qty
21
22
23
24
25
26
27
28
29

echo $@
if [ $# -lt 3 ]
then
  echo "Internal ERROR generalRunCostum.sh - Not enough arguments were given"
  exit -1
fi

#READ PARAMETERS AND ENSURE CORRECTNESS
30
31
cores=$1
configFile=$2
32
use_external=0
33
34
35
outFileIndex=0
qty=1

36
if [ $# -ge 3 ]
37
then
38
  use_external=$3
39
40
fi

41
if [ $# -ge 4 ]
42
then
43
  outFileIndex=$4
44
45
fi

46
if [ $# -ge 5 ]
47
then
48
  qty=$5
49
50
fi

51
numP=$(bash $PROTEO_HOME$execDir/BashScripts/getNumPNeeded.sh $configFile 0)
52
53
54
55
56
57
nodelist=$SLURM_JOB_NODELIST
if [ -z "$nodelist" ];
then
  nodelist="localhost"
  initial_nodelist="localhost"
else
58
  initial_nodelist=$(bash $PROTEO_HOME$execDir/BashScripts/createInitialNodelist.sh $numP $cores $nodelist)
59
60
61
62
fi

#EXECUTE RUN
echo "Nodes=$nodelist"
63
if [ $use_external -eq 0 ]
64
65
66
then
  for ((i=0; i<qty; i++))
  do
67
    echo "Run $i starts"
68
    mpirun -hosts $initial_nodelist -np $numP $PROTEO_BIN $configFile $outFileIndex
69
70
71
72
    echo "Run $i ends"
  done
elif [ $use_external -eq 1 ] #VALGRIND
then
73
  cp $PROTEO_HOME$execDir/Valgrind/worker_valgrind.sh .
74
75
76
  for ((i=0; i<qty; i++))
  do
    echo "Run $i starts"
77
    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 
78
    echo "Run $i ends"
79
80
  done
else
81
82
83
  cp $PROTEO_HOME$execDir/Extrae/extrae.xml .
  cp $PROTEO_HOME$execDir/Extrae/trace.sh .
  cp $PROTEO_HOME$execDir/Extrae/worker_extrae.sh .
84
85
  for ((i=0; i<qty; i++))
  do
86
    mpirun -hosts $initial_nodelist -np $numP ./trace.sh $PROTEO_BIN $configFile $outFileIndex 
87
88
89
90
  done
fi

echo "END TEST"