generalRunCostum.sh 2.26 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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.
# 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.
# Parameter 4 - Use Extrae(1) or not(0).
# 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 =======

codeDir="/Codes/build"
execDir="/Exec"
ResultsDir="/Results"

echo "START TEST"

#$1 == baseDir
#$2 == cores
#$3 == configFile
22
#$4 == use_external
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#$5 == outFileIndex
#$6 == qty

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

#READ PARAMETERS AND ENSURE CORRECTNESS
dir=$1
cores=$2
configFile=$3
37
use_external=0
38
39
40
41
42
outFileIndex=0
qty=1

if [ $# -ge 4 ]
then
43
  use_external=$4
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
fi

if [ $# -ge 5 ]
then
  outFileIndex=$5
fi

if [ $# -ge 6 ]
then
  qty=$6
fi

numP=$(bash $dir$execDir/BashScripts/getNumPNeeded.sh $configFile 0)
nodelist=$SLURM_JOB_NODELIST
if [ -z "$nodelist" ];
then
  nodelist="localhost"
  initial_nodelist="localhost"
else
  initial_nodelist=$(bash $dir$execDir/BashScripts/createInitialNodelist.sh $numP $cores $nodelist)
fi

#EXECUTE RUN
echo "Nodes=$nodelist"
68
if [ $use_external -eq 0 ]
69
70
71
then
  for ((i=0; i<qty; i++))
  do
72
    echo "Run $i starts"
73
    mpirun -hosts $initial_nodelist -np $numP $dir$codeDir/a.out $configFile $outFileIndex
74
75
76
77
78
79
80
81
82
83
    echo "Run $i ends"
  done
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"
84
85
86
87
  done
else
  cp $dir$execDir/Extrae/extrae.xml .
  cp $dir$execDir/Extrae/trace.sh .
88
  cp $dir$execDir/Extrae/worker_extrae.sh .
89
90
  for ((i=0; i<qty; i++))
  do
91
    mpirun -hosts $initial_nodelist -np $numP ./trace.sh $dir$codeDir/a.out $configFile $outFileIndex 
92
93
94
95
  done
fi

echo "END TEST"