Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
small fixes to output so that RL works again
[simgrid.git] / examples / gras / pmm / make_deployment.pl
index 3319f88..6d8fe8e 100755 (executable)
@@ -18,7 +18,7 @@ EOH
 }
 
 my $input    = shift @ARGV || usage();
-my $nb_hosts = shift @ARGV || "";
+my $nb_slaves = shift @ARGV || "";
 # my $source   = shift || "";
 
 my @host;
@@ -26,7 +26,7 @@ my @host;
 open IN,$input || die "Cannot open $input: $!\n";
 
 while (<IN>) {
-  next unless /<cpu name="([^"]*)"/; # "
+  next unless /<host id="([^"]*)"/; # "
   
   push @host, $1;
 }
@@ -36,8 +36,8 @@ 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;
+if (! $nb_slaves) {
+    $nb_slaves = (scalar @host) - 1;
 }
 
 #
@@ -47,8 +47,8 @@ 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 "<!DOCTYPE platform SYSTEM \"simgrid.dtd\">\n";
+print "<platform version=\"2\">\n\n";
 print "  <!-- The master, argument :: port number -->\n";
 print "  <process host=\"$master\" function=\"master\">\n";
 print "    <argument value=\"$port_num\"/>\n";
@@ -58,15 +58,15 @@ print "  </process>\n";
 # reset iterators
 my $it_host=1;
 
-for (my $i=0; $i<$nb_hosts; $i++) {
+for (my $i=0; $i<$nb_slaves; $i++) {
   print "  <process host=\"".$host[$it_host]."\" function=\"slave\"><argument value=\"$master:$port_num\"/></process>\n";
     
   $it_host ++;
   if ($it_host == scalar @host) {
-    $it_host=1;
+    $it_host = 0;
   }
 }
 
 
-print "</platform_description>\n";
+print "</platform>\n";