generalRunCostum.sh 1.37 KB
Newer Older
1
2
3
#!/bin/bash
#This script should only be called by others scripts, do not call it directly
codeDir="/Codes/build"
iker_martin's avatar
iker_martin committed
4
5
execDir="/Exec"
ResultsDir="/Results"
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

echo "START TEST"

#$1 == baseDir
#$2 == configFile
#$3 == use_extrae
#$4 == outFileIndex
#$5 == qty

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

#READ PARAMETERS AND ENSURE CORRECTNESS
dir=$1
configFile=$2
use_extrae=0
outFileIndex=0
qty=1

iker_martin's avatar
iker_martin committed
29
if [ $# -gt 3 ]
30
31
32
33
then
  use_extrae=$3
fi

iker_martin's avatar
iker_martin committed
34
if [ $# -gt 4 ]
35
36
37
38
then
  outFileIndex=$4
fi

iker_martin's avatar
iker_martin committed
39
if [ $# -gt 5 ]
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
then
  qty=$5
fi

nodelist=$SLURM_JOB_NODELIST
nodes=$SLURM_JOB_NUM_NODES
if [ -z "$nodelist" ];
then
  nodelist="localhost"
fi
if [ -z "$nodes" ];
then
  nodes=1
fi

aux=$(grep "\[resize0\]" -n $configFile | cut -d ":" -f1)
read -r ini fin <<<$(echo $aux)
diff=$(( fin - ini ))
numP=$(head -$fin $configFile | tail -$diff | cut -d ';' -f1 | grep Procs | cut -d '=' -f2)

#EXECUTE RUN
echo "Nodes=$nodelist"
if [ $use_extrae -ne 1 ]
then
  for ((i=0; i<qty; i++))
  do
    mpirun -np $numP $dir$codeDir/a.out $configFile $outFileIndex $nodelist $nodes 
  done
else
  cp $dir$execDir/Extrae/extrae.xml .
  cp $dir$execDir/Extrae/trace.sh .
  cp $dir$execDir/Extrae/trace_worker.sh .
  for ((i=0; i<qty; i++))
  do
    mpirun -np $numP ./trace.sh $dir$codeDir/a.out $configFile $outFileIndex $nodelist $nodes 
  done
fi

echo "END TEST"