generalRun.sh 1.56 KB
Newer Older
1
2
3
4
5
6
#!/bin/bash
#This script should only be called by others scripts, do not call it directly

#SBATCH --exclude=c02,c01,c00
#SBATCH -p P1
codeDir="/Codes/build"
7
8
execDir="/Exec"
ResultsDir="/Results"
9
10
11
12
13
14
15

echo "START TEST"

#$1 == baseDir
#$2 == configFile
#$3 == use_extrae
#$4 == outFileIndex
16
#$5 == qty
17
18
19
20
21
22
23
24

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

25
#READ PARAMETERS AND ENSURE CORRECTNESS
26
27
28
29
dir=$1
configFile=$2
use_extrae=$3
outFileIndex=$4
30
qty=1
iker_martin's avatar
iker_martin committed
31
if [ $# -gt 5 ]
32
33
34
then
  qty=$5
fi
35

36
37
38
39
40
41
42
43
44
45
46
47
nodelist=$SLURM_JOB_NODELIST
nodes=$SLURM_JOB_NUM_NODES
if [ -z "$nodelist" ];
then
  echo "Internal ERROR in generalRun.sh - Nodelist not provided"
  exit -1
fi
if [ -z "$nodes" ];
then
  nodes=1
fi

48
49
50
51
52
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)

53
54
#EXECUTE RUN
echo "Nodes=$nodelist"
55
56
if [ $use_extrae -ne 1 ]
then
57
58
  for ((i=0; i<qty; i++))
  do
59
    mpirun -np $numP $dir$codeDir/a.out $configFile $outFileIndex $nodelist $nodes 
60
  done
61
else
62
63
64
  cp $dir$execDir/Extrae/extrae.xml .
  cp $dir$execDir/Extrae/trace.sh .
  cp $dir$execDir/Extrae/trace_worker.sh .
65
66
  for ((i=0; i<qty; i++))
  do
67
    srun -n$numP --mpi=pmi2 ./trace.sh $dir$codeDir/a.out $configFile $outFileIndex $nodelist $nodes
68
  done
69
70
71
72
fi

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