X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3cbdff2439bf851c8bfe40bb452dc3a6f702424d..4c48bd895304f134d21a2f3a4eeb999a316463c6:/examples/gras/pmm/make_deployment.pl diff --git a/examples/gras/pmm/make_deployment.pl b/examples/gras/pmm/make_deployment.pl index 3e5f4c4018..6d8fe8e332 100755 --- a/examples/gras/pmm/make_deployment.pl +++ b/examples/gras/pmm/make_deployment.pl @@ -8,8 +8,9 @@ Usage: make_deployment.pl platform_file.xml nb_host This script generates a deployment file for the PMM program. It takes a SimGrid platform file as first argument and the number of wanted peers as -second argument. If the amount of peers exceeds the amount of available -hosts in the deployment file, several peers will be placed on the same host. +second (optional) argument. If the amount of peers exceeds the amount of +available hosts in the deployment file, several peers will be placed on the +same host. EOH ; @@ -17,15 +18,15 @@ EOH } my $input = shift @ARGV || usage(); -my $nb_hosts = shift @ARGV || usage(); -my $source = shift || ""; +my $nb_slaves = shift @ARGV || ""; +# my $source = shift || ""; my @host; open IN,$input || die "Cannot open $input: $!\n"; while () { - next unless /) { die "No host found in $input. Is it really a SimGrid platform file?\nCheck that you didn't pass a deployment file, for example.\n" unless (scalar @host); +if (! $nb_slaves) { + $nb_slaves = (scalar @host) - 1; +} # # generate the file. Master first (quite logical, indeed) -print "\n"; -print "\n"; -print "\n\n"; -print " \n"; -print " \n"; - -# put the slaves as argument of the master +my $port_num = 4000; +my $master = $host[0]; -my $it_host=0; # iterator -my $it_port=4000; # iterator, in case we have so much processes to add that we must change it -for (my $i=0; $i<$nb_hosts; $i++) { - print " \n"; - $it_host ++; - if ($it_host == scalar @host) { - $it_host=0; - $it_port++; - } -} +print "\n"; +print "\n"; +print "\n\n"; +print " \n"; +print " \n"; +print " \n"; print " \n"; # Start the slaves also # reset iterators -$it_port=4000; -$it_host=0; +my $it_host=1; -for (my $i=0; $i<$nb_hosts; $i++) { - print " \n"; +for (my $i=0; $i<$nb_slaves; $i++) { + print " \n"; $it_host ++; if ($it_host == scalar @host) { - $it_host=0; - $it_port++; + $it_host = 0; } } -print "\n"; +print "\n";