singleRun.sh 2.2 KB
Newer Older
1
2
#!/bin/bash

3
dir="/home/usuario/Documentos/malleability_benchmark"
4
5
6
7
8
9
10
11
12
13
14
15
partition="P1"
exclude="c00,c01,c02"
cores=20

# Executes a given configuration file with the aid of
# the RMS Slurm.
# Parameter 1: Configuration file name for the emulation.
# Parameter 2(Optional): Index to use for the output files. Must be a positive integer.
# Parameter 3(Optional): Number of repetitions to perform. Must be a positive integer.
# Parameter 4(Optional): Use Extrae(1) or not(0).
# Parameter 5(Optional): Path where the output files should be saved. 
#====== Do not modify these values =======
16

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

21
if [ $# -lt 1 ]
22
23
then
  echo "Not enough arguments. Usage:"
24
  echo "bash singleRun.sh config.ini [outFileIndex] [Qty] [Use extrae] [Output path]"
25
26
27
  exit 1
fi

28
29
#$1 == configFile
#$2 == outFileIndex
30
#$3 == Qty of repetitions
31
32
#$4 == Use extrae NO(0) YES(1)
#$5 == Output path
33

34
35
config_file=$1
outFileIndex=0
36
qty=1
37
use_extrae=0
38

39
if [ $# -ge 2 ]
40
41
42
then
  outFileIndex=$2
fi
43
if [ $# -ge 3 ]
44
45
then
  qty=$3
46
fi
47
if [ $# -ge 4 ]
48
49
50
then
  use_extrae=$4
fi
51
if [ $# -ge 5 ]
52
53
then
  output=$5
54
55
fi

56
57
#1 - Obtain maximum number of processes for the run
max_numP=-1
58
total_groups=$(grep Total_Resizes $config_file | cut -d '=' -f2)
59
for ((j=0; j<total_groups; j++)); 
60
do
61
62
63
64
65
66
67
68
69
  resize_info=$(grep "\[resize$j\]" -n $config_file | cut -d ":" -f1)
  first_line=$(echo $resize_info | cut -d " " -f1)
  last_line=$(echo $resize_info | cut -d " " -f2)
  range_lines=$(( last_line - first_line ))
  numP=$(head -$last_line $config_file | tail -$range_lines | cut -d ';' -f1 | grep Procs | cut -d '=' -f2)
  if [ "$numP" -gt "$max_numP" ];
  then
    max_numP=$numP
  fi
70
done
71

72
73
74
75
76
77
#2 - Obtain needed nodes for the number of processes
node_qty=$(($max_numP / $cores))
if [ "$node_qty" -eq "0" ];
then
  node_qty=1
fi
78

79
80
81
82
#3 - Run with the expected amount of nodes
sbatch -p $partition --exclude=$exclude -N $node_qty $dir$execDir/generalRun.sh $dir $config_file $use_extrae $outFileIndex $qty

if ! [ -z "$output" ]
83
then
84
  mkdir -p $output
85
86
87
  echo "Moving data to $output\nMoved files:"
  ls R${outFileIndex}_G*
  mv R${outFileIndex}_G* $output
88
89
90
91
92
93
  if [ "$use_extrae" -eq 1 ]
  then
    mv a.out.* $output
    mv TRACE* $output
    mv set-0/ $output
  fi
94
fi