source: CIVL/mods/dev.civl.com/scripts/scale/run.pl@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100755
File size: 2.6 KB
RevLine 
[2138309]1#!/usr/bin/perl
[c55ef7f]2use Path::Class;
3use File::Basename;
4use autodie;
5use strict;
6use warnings;
7use File::Path qw(make_path);
[2138309]8
9my $civlDir="."; # directory to civl
10my $numArgs = scalar(@ARGV);
[c55ef7f]11my $datOut = ".";
[2138309]12my $benchOut = "bench.scale.out";
[e805cd7]13my $hasCivlDir=0;
[c55ef7f]14my $datDir;
[c56a303]15my $lastReleaseDat;
[2138309]16
17for(my $i=0; $i < $numArgs; $i++){
18 my $arg = $ARGV[$i];
19
20 if($arg =~ /^\-d(.*)$/){
21 $civlDir=$1;
[e805cd7]22 $hasCivlDir=1;
[2138309]23 }elsif ($arg =~ /^\-o(.*)$/){
[c55ef7f]24 $datOut = $1;
25 #if(!($datOut =~ /\.pdf$/)){
26 #warn "$out is not a pdf file name, $out.pdf will be used for output file instead.\n";
27 # $out="$out.pdf";
28 # }
[2138309]29 }else{
30 warn "Arguments should start with -d or -o, invalid argument $arg would be ignored.\n";
31 }
32}
33
[e805cd7]34if($hasCivlDir == 0){
35 warn "no civl directory is provided, current directory will be used as the civl directory.\n";
36}
37
[c55ef7f]38unless (-d $datOut) {
39 mkdir $datOut;
40}
41$benchOut="$datOut/$benchOut";
42
[2138309]43my $scriptPrefix="$civlDir/scripts/scale";
44
[c56a303]45## Get last release version number ...
46my $lastReleaseVersion;
47
48opendir(my $scriptDir, "$scriptPrefix");
49while (readdir $scriptDir) {
[cef1196]50 if ($_ =~ (/^v(([0-9]+).([0-9]+).([0-9]*))_bench_dat$/)) {
[c56a303]51 $lastReleaseVersion = $1;
52 print "Benchmark running results of CIVL v$lastReleaseVersion found\n";
53 last;
54 }
55}
56
[2138309]57print "running scale benchmarks...\n";
58my $cmd = `$scriptPrefix/runBenchScale.pl $civlDir -o$benchOut`;
[c55ef7f]59print "scale benchmarks finished, now generating .dat file in $datOut...\n";
60$cmd = `$scriptPrefix/parseScale.pl $benchOut $datOut`;
[2138309]61print ".dat file finished, now generating figure...\n";
62
[c55ef7f]63$datDir=dir("$datOut");
64while(my $datFile = $datDir->next){
65 next unless ($datFile =~ /\.dat$/);
66 my $benchmark;
67
68 $datFile = basename($datFile, "");
69 ($benchmark) = ($datFile =~ /(.*)\.dat/);
[66ace0d]70 if($benchmark eq "Diningphilosopher"){
71 $benchmark="Dining philosopher";
72 }
[c55ef7f]73 print "plotting figure for benchmark $benchmark...\n";
[c56a303]74 if (defined $lastReleaseVersion) {
[d41e37f]75 $cmd = `gnuplot -e "TITLE='$benchmark'" -e "DAT_FILE='$datOut/$datFile'" -e "OUT_FILE='$datOut/$benchmark.pdf'" -e "LAST_DAT_FILE='$scriptPrefix/v$lastReleaseVersion\_bench_dat/$datFile'" -e "LAST_VERSION='v$lastReleaseVersion'" $scriptPrefix/plotBench.plg`;
[c56a303]76 } else {
77 print "No benchmark running results of previous versions found\n";
78 $cmd = `gnuplot -e "TITLE='$benchmark'" -e "DAT_FILE='$datOut/$datFile'" -e "OUT_FILE='$datOut/$benchmark.pdf'" $scriptPrefix/plotBench.plg`;
79 }
[c55ef7f]80}
[4723002]81print "scaling figures is successfully generated in $datOut\n";
[cef1196]82#print "copy benchmark results to Ziqing's directory /home/ziqing ...";
83#$cmd = `cp -a $datDir /home/ziqing/ `;
[e4a8d2d]84
85
86
Note: See TracBrowser for help on using the repository browser.