From 5a4c96d13256b0e6cefa972c52d3859b3e34cbe0 Mon Sep 17 00:00:00 2001 From: eyraudl Date: Mon, 27 Aug 2007 14:24:46 +0000 Subject: [PATCH] Round-robin deployment so that everybody does not send to the same guy at the same time. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4118 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/gras/all2all/make_deployment.pl | 70 ++++++++++++------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/examples/gras/all2all/make_deployment.pl b/examples/gras/all2all/make_deployment.pl index 1e4bf687a5..8698ac654d 100755 --- a/examples/gras/all2all/make_deployment.pl +++ b/examples/gras/all2all/make_deployment.pl @@ -21,9 +21,9 @@ EOH } my $input = shift @ARGV || usage(); -my $nb_hosts = shift @ARGV || usage(); my $size_msg = shift @ARGV || usage(); -my $source = shift || ""; +my $source = shift @ARGV || ""; +my $nb_hosts = shift @ARGV || 0; my @host; @@ -40,23 +40,27 @@ while () { 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_hosts) { + $nb_hosts = scalar @host; +} + + # # Build the receiver string -my $receivers; # strings containing sender argument describing all receivers. +my @receivers; # strings containing sender argument describing all receivers. 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++) { - $receivers .= " \n"; + push (@receivers, "$host[$it_host]:$it_port"); $it_host ++; if ($it_host == scalar @host) { $it_host=0; $it_port++; } } -$receivers .= " \n"; # # and now, really generate the file. Receiver first. @@ -65,41 +69,37 @@ print "\n"; print "\n"; print "\n\n"; -# reset iterators -$it_port=4000; -$it_host=0; - -for (my $i=0; $i<$nb_hosts; $i++) { - print " \n"; - print " \n"; - print " \n\n"; - - $it_host ++; - if ($it_host == scalar @host) { - $it_host=0; - $it_port++; - } +for my $r (@receivers) { + my ($h, $p) = split(':', $r); + print " \n"; + print " \n"; + print " \n\n"; } # # Here come the sender(s) -# reset iterators -$it_port=4000; -$it_host=0; - -for (my $i=0; $i<$nb_hosts; $i++) { - if (!length($source) || $source == $i) { - print " \n"; - print $receivers; - print " \n"; - } - - $it_host ++; - if ($it_host == scalar @host) { - $it_host=0; - $it_port++; - } +if(length($source)) { + print " \n"; + for my $r (@receivers) { + print " \n"; + } + print " \n"; + print " \n"; +} else { + my $i = 0; + for my $r (@receivers) { + my ($h, $p) = split(":", $r); + print " \n"; + for (my $j = 0; $j < $nb_hosts; $j++) { + my $r2 = $receivers[($i + $j) % ($nb_hosts)]; + print " \n"; + } + print " \n"; + print " \n"; + $i++; + } } print "\n"; -- 2.20.1