getMaxNodesNeeded.sh 874 Bytes
Newer Older
1
2
3
4
#!/bin/bash

# Obtains for a given configuration file how many nodes will be needed
# Parameter 1 - Configuration file name for the emulation.
5
# Parameter 2 - Number of cores in the machines. The machines must be homogenous. Must be a positive number.
6
7
8
9
#====== Do not modify these values =======

execDir="/Exec"

10
if [ "$#" -lt "2" ]
11
12
then
  echo "Not enough arguments"
13
  echo "Usage -> bash getMaxNodesNeeded.sh Configuration.ini NumCores"
14
15
16
17
  exit -1
fi

config_file=$1
18
cores=$2
19
20
21
22
23
24

max_numP=-1
total_resizes=$(grep Total_Resizes $config_file | cut -d '=' -f2)
total_groups=$(($total_resizes + 1))
for ((j=0; j<total_groups; j++));
do
25
  numP=$(bash $PROTEO_HOME$execDir/BashScripts/getNumPNeeded.sh $config_file $j)
26
27
28
29
30
31
32
33
34
35
36
37
  if [ "$numP" -gt "$max_numP" ];
  then
    max_numP=$numP
  fi
done
node_qty=$(($max_numP / $cores))
if [ $node_qty -eq 0 ]
then
  node_qty=1
fi

echo $node_qty