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

3
4
5
6
7
8
9
10
11
partition="P1"
exclude="c00,c01,c02"

# 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).
12
13
# Parameter 5(Optional): Maximum amount of time in seconds needed by a single execution. Default value is 0, which indicates infinite time. Must be a positive integer.
# Parameter 6(Optional): Path where the output files should be saved. 
14
#====== Do not modify these values =======
15

16
17
scriptDir="$(dirname "$0")"
source $scriptDir/../Codes/build/config.txt
18
19
20
codeDir="/Codes/build"
execDir="/Exec"
ResultsDir="/Results"
21
cores=$(bash $dir$execDir/BashScripts/getCores.sh $partition)
22

iker_martin's avatar
iker_martin committed
23
if [ $# -lt 1 ]
24
25
then
  echo "Not enough arguments. Usage:"
26
  echo "bash singleRun.sh config.ini [outFileIndex] [Qty] [Use extrae] [Output path]"
27
28
29
  exit 1
fi

30
31
#$1 == configFile
#$2 == outFileIndex
32
#$3 == Qty of repetitions
33
#$4 == Use extrae NO(0) YES(1)
34
35
#$5 == Max time per execution(s)
#$6 == Output path
36

37
38
config_file=$1
outFileIndex=0
39
qty=1
40
use_extrae=0
41

iker_martin's avatar
iker_martin committed
42
if [ $# -ge 2 ]
43
44
45
then
  outFileIndex=$2
fi
iker_martin's avatar
iker_martin committed
46
if [ $# -ge 3 ]
47
48
then
  qty=$3
49
fi
iker_martin's avatar
iker_martin committed
50
if [ $# -ge 4 ]
51
52
53
then
  use_extrae=$4
fi
54
55
limit_time=$((0))
if [ $# -ge 5 ] #Max time per execution in seconds
56
then
57
  limit_time=$(($5 * $qty / 60 + 1))
58
fi
59
if [ $# -ge 6 ]
60
then
61
  output=$6
62
fi
63

64
65
66
67
#Obtain amount of nodes neeeded
node_qty=$(bash $dir$execDir/BashScripts/getMaxNodesNeeded.sh $config_file $dir $cores)
#Run with the expected amount of nodes
sbatch -p $partition --exclude=$exclude -N $node_qty -t $limit_time $dir$execDir/generalRun.sh $dir $cores $config_file $use_extrae $outFileIndex $qty
68
69

if ! [ -z "$output" ]
70
then
71
  mkdir -p $output
72
73
74
  echo "Moving data to $output\nMoved files:"
  ls R${outFileIndex}_G*
  mv R${outFileIndex}_G* $output
75
76
77
78
79
80
  if [ "$use_extrae" -eq 1 ]
  then
    mv a.out.* $output
    mv TRACE* $output
    mv set-0/ $output
  fi
81
fi