-for (my $i=0; $i<$nb_hosts; $i++) {
- print " <process host=\"".$host[$it_host]."\" function=\"sender\">\n";
- print $receivers;
- print " </process>\n";
-
- print " <process host=\"".$host[$it_host]."\" function=\"receiver\">\n";
- print " <argument value=\"$it_port\"/><argument value=\"$nb_hosts\"/>\n";
- print " </process>\n\n";
-
- $it_host ++;
- if ($it_host == scalar @host) {
- $it_host=0;
- $it_port++;
- }
+#
+# Here come the sender(s)
+
+if(length($source)) {
+ print " <process host=\"".$host[$source % (scalar @host)].
+ "\" function=\"sender\">\n";
+ for my $r (@receivers) {
+ print " <argument value=\"$r\"/>\n";
+ }
+ print " <argument value=\"$size_msg\"/>\n";
+ print " </process>\n";
+} else {
+ my $i = 0;
+ for my $r (@receivers) {
+ my ($h, $p) = split(":", $r);
+ print " <process host=\"".$h."\" function=\"sender\">\n";
+ for (my $j = 0; $j < $nb_hosts; $j++) {
+ my $r2 = $receivers[($i + $j) % ($nb_hosts)];
+ print " <argument value=\"$r2\"/>\n";
+ }
+ print " <argument value=\"$size_msg\"/>\n";
+ print " </process>\n";
+ $i++;
+ }