Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Chord: load a platform with appropriate size
[simgrid.git] / examples / msg / chord / run_chord
1 #!/bin/bash
2
3 # This script runs Chord with the specified number of nodes.
4 # Usage: ./run_chord nb_nodes
5 # The platform file is chosen as the smallest platform of the files
6 # examples/platforms/cluster_with_*_hosts.xml that contains enough nodes.
7
8 # check arguments number
9 if [ $# != 1 ]; then
10   echo "Usage: ./run_chord nb_nodes"
11   exit 1
12 fi
13
14 # pick an appropriate platform file
15 if [ $1 -le 100 ]; then
16   platform=100
17 else
18   if [ $1 -le 1000 ]; then
19     platform=1000
20   else
21     if [ $1 -le 10000 ]; then
22       platform=10000
23     else
24       if [ $1 -le 100000 ]; then
25         platform=100000
26       else
27         if [ $1 -le 300000 ]; then
28           platform=300000
29         else
30           echo "Cannot find a platform file large enough."
31           exit 2
32         fi
33       fi
34     fi
35   fi
36 fi
37
38 # set up the deployment file
39 nb_lines=$[ $1 + 3]
40 head -n $nb_lines chord300000.xml > tmp_depl.xml
41 echo "</platform>" >> tmp_depl.xml
42
43 # run Chord
44 ./chord -nb_bits=24 -timeout=50 "../../platforms/cluster_with_${platform}_hosts.xml" tmp_depl.xml
45
46 # cleanup
47 # rm tmp_depl.xml
48