7 Usage: make_deployment.pl platform_file.xml nb_host
9 This script generates a deployment file for the PMM program. It takes
10 a SimGrid platform file as first argument and the number of wanted peers as
11 second (optional) argument. If the amount of peers exceeds the amount of
12 available hosts in the deployment file, several peers will be placed on the
20 my $input = shift @ARGV || usage();
21 my $nb_hosts = shift @ARGV || "";
22 # my $source = shift || "";
26 open IN,$input || die "Cannot open $input: $!\n";
29 next unless /<cpu name="([^"]*)"/; # "
34 # map { print "$_\n" } @host;
36 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"
37 unless (scalar @host);
40 $nb_hosts = scalar @host;
44 # generate the file. Master first (quite logical, indeed)
47 my $master = $host[0];
49 print "<?xml version='1.0'?>\n";
50 print "<!DOCTYPE platform_description SYSTEM \"surfxml.dtd\">\n";
51 print "<platform_description version=\"1\">\n\n";
52 print " <!-- The master, argument :: port number -->\n";
53 print " <process host=\"$master\" function=\"master\">\n";
54 print " <argument value=\"$port_num\"/>\n";
55 print " </process>\n";
57 # Start the slaves also
61 for (my $i=0; $i<$nb_hosts; $i++) {
62 print " <process host=\"".$host[$it_host]."\" function=\"slave\"><argument value=\"$master:$port_num\"/></process>\n";
65 if ($it_host == scalar @host) {
71 print "</platform_description>\n";