Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Modify the all2all to support all data Message Size
[simgrid.git] / examples / gras / all2all / make_deployment.pl
index 6b4e2e3..1e4bf68 100755 (executable)
@@ -4,14 +4,16 @@ use strict;
 
 sub usage {
     print STDERR <<EOH
-Usage: all2all_make_deployment.pl platform_file.xml nb_host (bcast source?)
+Usage: all2all_make_deployment.pl platform_file.xml nb_host size_msg (bcast source?)
   
 This script generates a deployment file for the all2all 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.
-      
-If a third argument is passed, this is the source of the broadcast
+
+The third argument is a size of the message to send ( octets )  
+
+If a fourth argument is passed, this is the source of the broadcast
 (given as a number between 0 and nb_host-1).
 EOH
       ;
@@ -20,7 +22,8 @@ EOH
 
 my $input    = shift @ARGV || usage();
 my $nb_hosts = shift @ARGV || usage();
-my $source   = shift;
+my $size_msg = shift @ARGV || usage();
+my $source   = shift || "";
 
 my @host;
 
@@ -53,13 +56,14 @@ for (my $i=0; $i<$nb_hosts; $i++) {
     $it_port++;
   }
 }
+$receivers .= "    <argument value=\"$size_msg\"/>\n";
 
 #
 # and now, really generate the file. Receiver first.
 
 print "<?xml version='1.0'?>\n";
 print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
-print "<platform_description>\n\n";
+print "<platform_description version=\"1\">\n\n";
 
 # reset iterators
 $it_port=4000;
@@ -67,7 +71,7 @@ $it_host=0;
 
 for (my $i=0; $i<$nb_hosts; $i++) {
   print "  <process host=\"".$host[$it_host]."\" function=\"receiver\">\n";
-  print "    <argument value=\"$it_port\"/><argument value=\"".(undef($source)?$nb_hosts:1)."\"/>\n";
+  print "    <argument value=\"$it_port\"/><argument value=\"".(length($source)?1:$nb_hosts)."\"/>\n";
   print "  </process>\n\n";
     
   $it_host ++;
@@ -85,7 +89,7 @@ $it_port=4000;
 $it_host=0;
 
 for (my $i=0; $i<$nb_hosts; $i++) {
-  if (undef($source) || $source == $i) {
+  if (!length($source) || $source == $i) {
       print "  <process host=\"".$host[$it_host]."\" function=\"sender\">\n";
       print $receivers;
       print "  </process>\n";
@@ -99,3 +103,5 @@ for (my $i=0; $i<$nb_hosts; $i++) {
 }
 
 print "</platform_description>\n";
+
+# print "source='$source' nb_hosts=$nb_hosts\n";