From: mquinson Date: Thu, 15 Oct 2009 16:26:55 +0000 (+0000) Subject: A script to recompile and rerun the whole chain from platfile+daxfile to actual repla... X-Git-Tag: SVN~919 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a4a84f51e0c339bf40273956d4267e43d408c0ff A script to recompile and rerun the whole chain from platfile+daxfile to actual replay on simulator git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6795 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/examples/gras/replay/do_simulation.pl b/examples/gras/replay/do_simulation.pl new file mode 100755 index 0000000000..5d8301ac74 --- /dev/null +++ b/examples/gras/replay/do_simulation.pl @@ -0,0 +1,86 @@ +#! /usr/bin/perl + +use strict; + +my $platfile = $ARGV[0] || die "Usage: $0 platfile daxfile\n"; +my $daxfile = $ARGV[1] || die "Usage: $0 platfile daxfile\n"; + +sub title { + my $l = "XXXX $0: $_[0] XXXX"; + my $l2 = $l; + $l2 =~ s/./X/g; + print STDERR "\n\n$l2\n$l\n$l2\n"; +} + +title("relaunching make"); +system qw(make -C ../../../src libsimgrid.la) and die "XXXX $0: make library failed: $?\n"; +system qw(make -C ../../simdag dax/dax_test) and die "XXXX $0: make dax_test failed.\n"; +system qw(make replay_simulator) and die "XXXX $0: make replay_simulator failed.\n"; + +################################################### +my $tracefile = "$daxfile"; +$tracefile =~ s/\.xml$//; +$tracefile .= ".trace"; +title("Regenerating the trace '$tracefile'"); +my @args = ("../../simdag/dax/dax_test", "$platfile", "$daxfile","$tracefile"); +system @args and die "XXXX $0: cannot regenerate the trace '$tracefile': $?\n"; + + +################################################### +my $deployfile = "deploy_$platfile"; +$deployfile =~ s/\.xml$//; +$deployfile .= "_".$daxfile; +title("Generate a deployment file '$deployfile'"); +my %hosts; + +print STDERR "$0: parsing the trace file '$tracefile'\n"; +open TRACE,"$tracefile" || die "$0: cannot open tracefile $tracefile: $!\n"; +while () { + # print "Seen $_"; + next unless /compute/; + m/^\[.*?\] ([^ ]*) .*$/ || die "unparsable line: $_"; + if (defined $hosts{$1}) { + $hosts{$1}+=1; + } else { + $hosts{$1}++; + } +} +close TRACE; +my @hostnames = sort keys %hosts; +my $master = $hostnames[0]; + +foreach my $host (@hostnames) { + if ($host ne $master && $hosts{$host} > 1) { + print STDERR "$host computes $hosts{$host} times!\n"; + } +} + +print STDERR "$0: Generating the xml deployment file\n"; +open DEPLOY,">$deployfile"; +print DEPLOY "\n"; +print DEPLOY "\n\n"; +print DEPLOY "\n\n"; +print DEPLOY "\n"; + +print DEPLOY " \n"; +print DEPLOY " \n"; +print DEPLOY " \n"; +print DEPLOY " \n"; + +foreach my $host (@hostnames) { + print DEPLOY " "; + print DEPLOY ""; + print DEPLOY "\n"; +} + +print DEPLOY "\n"; +close DEPLOY; +print STDERR "$0: Xml deployment file generated\n"; + +################################################### +title("Replay this trace onto the simulator"); +system ("./replay_simulator","$platfile","$deployfile") + and die "Cannot replay the trace. Command was:\n./replay_simulator $platfile $deployfile\n"; + + +# \ No newline at end of file