Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update make_deployment.pl script to the current command-line behavior of pmm.
authoreyraudl <eyraudl@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 14 Nov 2006 09:23:22 +0000 (09:23 +0000)
committereyraudl <eyraudl@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 14 Nov 2006 09:23:22 +0000 (09:23 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2921 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/gras/pmm/make_deployment.pl
examples/gras/pmm/pmm.c

index 3e5f4c4..3319f88 100755 (executable)
@@ -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,8 +18,8 @@ EOH
 }
 
 my $input    = shift @ARGV || usage();
-my $nb_hosts = shift @ARGV || usage();
-my $source   = shift || "";
+my $nb_hosts = shift @ARGV || "";
+my $source   = shift || "";
 
 my @host;
 
@@ -35,42 +36,34 @@ while (<IN>) {
 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;
+}
 
 #
 # generate the file. Master first (quite logical, indeed)
 
+my $port_num = 4000;
+my $master = $host[0];
+
 print "<?xml version='1.0'?>\n";
 print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
 print "<platform_description version=\"1\">\n\n";
-print "  <!-- The master, arguments :: all others nodes -->\n";
-print "  <process host=\"$host[0]\" function=\"master\">\n";
-
-# put the slaves as argument of the master
-
-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 "    <argument value=\"$host[$it_host]:$it_port\"/>\n";
-  $it_host ++;
-  if ($it_host == scalar @host) {
-    $it_host=0;
-    $it_port++;
-  }
-}
+print "  <!-- The master, argument :: port number -->\n";
+print "  <process host=\"$master\" function=\"master\">\n";
+print "    <argument value=\"$port_num\"/>\n";
 print "  </process>\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 "  <process host=\"".$host[$it_host]."\" function=\"slave\"><argument value=\"$it_port\"/></process>\n";
+  print "  <process host=\"".$host[$it_host]."\" function=\"slave\"><argument value=\"$master:$port_num\"/></process>\n";
     
   $it_host ++;
   if ($it_host == scalar @host) {
-    $it_host=0;
-    $it_port++;
+    $it_host=1;
   }
 }
 
index ccd06b2..22d0480 100755 (executable)
@@ -113,6 +113,7 @@ int master (int argc,char *argv[]) {
        i++) {
 
     xbt_dynar_get_cpy(peers,i,&grid[i]);
+    INFO2("Connecting to %s:%d.",grid[i]->name,grid[i]->port);
     socket[i]=gras_socket_client(grid[i]->name,grid[i]->port);
     INFO2("Connected to %s:%d.",grid[i]->name,grid[i]->port);
   }
@@ -125,6 +126,7 @@ int master (int argc,char *argv[]) {
     xbt_peer_t h;
 
     xbt_dynar_get_cpy(peers,i,&h);
+    INFO2("Killing %s:%d", h->name, h->port);
     amok_pm_kill_hp(h->name,h->port);
     free(h);
   }