Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Modify the experimentation suite so that it can test the broadcast stuff
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 19 May 2006 10:36:26 +0000 (10:36 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 19 May 2006 10:36:26 +0000 (10:36 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2254 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/gras/all2all/make_deployment.pl
examples/gras/all2all/run.sh

index cf0e4c0..6b4e2e3 100755 (executable)
@@ -4,12 +4,15 @@ use strict;
 
 sub usage {
     print STDERR <<EOH
 
 sub usage {
     print STDERR <<EOH
-Usage: all2all_make_deployment.pl platform_file.xml nb_host
+Usage: all2all_make_deployment.pl platform_file.xml nb_host (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 
   
 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. 
+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
+(given as a number between 0 and nb_host-1).
 EOH
       ;
     die "\n";
 EOH
       ;
     die "\n";
@@ -17,6 +20,7 @@ EOH
 
 my $input    = shift @ARGV || usage();
 my $nb_hosts = shift @ARGV || usage();
 
 my $input    = shift @ARGV || usage();
 my $nb_hosts = shift @ARGV || usage();
+my $source   = shift;
 
 my @host;
 
 
 my @host;
 
@@ -51,7 +55,7 @@ for (my $i=0; $i<$nb_hosts; $i++) {
 }
 
 #
 }
 
 #
-# and now, really generate the file
+# and now, really generate the file. Receiver first.
 
 print "<?xml version='1.0'?>\n";
 print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
 
 print "<?xml version='1.0'?>\n";
 print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
@@ -62,12 +66,8 @@ $it_port=4000;
 $it_host=0;
 
 for (my $i=0; $i<$nb_hosts; $i++) {
 $it_host=0;
 
 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 "  <process host=\"".$host[$it_host]."\" function=\"receiver\">\n";
-  print "    <argument value=\"$it_port\"/><argument value=\"$nb_hosts\"/>\n";
+  print "    <argument value=\"$it_port\"/><argument value=\"".(undef($source)?$nb_hosts:1)."\"/>\n";
   print "  </process>\n\n";
     
   $it_host ++;
   print "  </process>\n\n";
     
   $it_host ++;
@@ -77,4 +77,25 @@ for (my $i=0; $i<$nb_hosts; $i++) {
   }
 }
 
   }
 }
 
+#
+# Here come the sender(s)
+
+# reset iterators
+$it_port=4000;
+$it_host=0;
+
+for (my $i=0; $i<$nb_hosts; $i++) {
+  if (undef($source) || $source == $i) {
+      print "  <process host=\"".$host[$it_host]."\" function=\"sender\">\n";
+      print $receivers;
+      print "  </process>\n";
+  }
+    
+  $it_host ++;
+  if ($it_host == scalar @host) {
+    $it_host=0;
+    $it_port++;
+  }
+}
+
 print "</platform_description>\n";
 print "</platform_description>\n";
index e27ac15..36d5147 100755 (executable)
@@ -1,15 +1,18 @@
 #! /bin/bash
 
 #
 #! /bin/bash
 
 #
-# USAGE: run.sh  plaform  nb_host
+# USAGE: run.sh  plaform  nb_host (broadcast source?)
 #
 # This script takes a platform file and a number of hosts as argument.
 #
 # This script takes a platform file and a number of hosts as argument.
+#  if a third argument is passed, this is the source of the broadcast 
+#  (given as a number between 0 and nb_host-1).
 #
 # It generates the right deployment platform and run the experiment, 
 #  only showing the last line of the run, showing the resulting time.
 
 plat=$1
 nb_host=$2
 #
 # It generates the right deployment platform and run the experiment, 
 #  only showing the last line of the run, showing the resulting time.
 
 plat=$1
 nb_host=$2
+bcast=$3
 set -e
 
 if [ -z $plat -o -z $nb_host ] ; then
 set -e
 
 if [ -z $plat -o -z $nb_host ] ; then
@@ -23,7 +26,7 @@ if ! [ -e $plat ] ; then
 fi
 
 echo "Generating the deployment"
 fi
 
 echo "Generating the deployment"
-./make_deployment.pl $plat $nb_host > tmp_deployment_$nb_host
+./make_deployment.pl $plat $nb_host $bcast > tmp_deployment_$nb_host
 echo "Running the experiment"
 ./all2all_simulator $plat tmp_deployment_$nb_host 2>&1 |tee run.log|grep "Congrat"
 rm tmp_deployment_$nb_host
 echo "Running the experiment"
 ./all2all_simulator $plat tmp_deployment_$nb_host 2>&1 |tee run.log|grep "Congrat"
 rm tmp_deployment_$nb_host