5 my $platfile = $ARGV[0] || die "Usage: $0 platfile daxfile\n";
6 my $daxfile = $ARGV[1] || die "Usage: $0 platfile daxfile\n";
9 my $l = "XXXX $0: $_[0] XXXX";
12 print STDERR "\n\n$l2\n$l\n$l2\n";
15 title("relaunching make");
16 system qw(make -C ../../../src libsimgrid.la) and die "XXXX $0: make library failed: $?\n";
17 system qw(make -C ../../simdag dax/dax_test) and die "XXXX $0: make dax_test failed.\n";
18 system qw(make replay_simulator) and die "XXXX $0: make replay_simulator failed.\n";
20 ###################################################
21 my $tracefile = "$daxfile";
22 $tracefile =~ s/\.xml$//;
23 $tracefile .= ".trace";
24 title("Regenerating the trace '$tracefile'");
25 my @args = ("../../simdag/dax/dax_test", "$platfile", "$daxfile","$tracefile");
26 system @args and die "XXXX $0: cannot regenerate the trace '$tracefile': $?\n";
29 ###################################################
30 my $deployfile = "deploy_$platfile";
31 $deployfile =~ s/\.xml$//;
32 $deployfile .= "_".$daxfile;
33 title("Generate a deployment file '$deployfile'");
36 print STDERR "$0: parsing the trace file '$tracefile'\n";
37 open TRACE,"$tracefile" || die "$0: cannot open tracefile $tracefile: $!\n";
40 next unless /compute/;
41 m/^\[.*?\] ([^ ]*) .*$/ || die "unparsable line: $_";
42 if (defined $hosts{$1}) {
49 my @hostnames = sort keys %hosts;
50 my $master = $hostnames[0];
52 foreach my $host (@hostnames) {
53 if ($host ne $master && $hosts{$host} > 1) {
54 print STDERR "$host computes $hosts{$host} times!\n";
58 print STDERR "$0: Generating the xml deployment file\n";
59 open DEPLOY,">$deployfile";
60 print DEPLOY "<?xml version='1.0'?>\n";
61 print DEPLOY "<!DOCTYPE platform SYSTEM \"simgrid.dtd\">\n\n";
62 print DEPLOY "<!-- File generated by \"$0 $tracefile\" at ".(localtime())." -->\n\n";
63 print DEPLOY "<platform version=\"2\">\n";
65 print DEPLOY " <process host=\"$master\" function=\"master\">\n";
66 print DEPLOY " <argument value=\"$tracefile\" /> <!-- trace file -->\n";
67 print DEPLOY " <argument value=\"4500\"/> <!-- port number -->\n";
68 print DEPLOY " </process>\n";
70 foreach my $host (@hostnames) {
71 print DEPLOY " <process host=\"$host\" function=\"worker\">";
72 print DEPLOY "<argument value=\"$master:4500\" />";
73 print DEPLOY "</process>\n";
76 print DEPLOY "</platform>\n";
78 print STDERR "$0: Xml deployment file generated\n";
80 ###################################################
81 title("Replay this trace onto the simulator");
82 system ("./replay_simulator","$platfile","$deployfile")
83 and die "Cannot replay the trace. Command was:\n./replay_simulator $platfile $deployfile\n";