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
Line 
1#!/usr/bin/perl
2use Path::Class;
3use File::Basename;
4use autodie;
5use strict;
6use warnings;
7use File::Path qw(make_path);
8
9my $civlDir="."; # directory to civl
10my $numArgs = scalar(@ARGV);
11my $datOut = ".";
12my $benchOut = "bench.scale.out";
13my $hasCivlDir=0;
14my $datDir;
15my $lastReleaseDat;
16
17for(my $i=0; $i < $numArgs; $i++){
18 my $arg = $ARGV[$i];
19
20 if($arg =~ /^\-d(.*)$/){
21 $civlDir=$1;
22 $hasCivlDir=1;
23 }elsif ($arg =~ /^\-o(.*)$/){
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 # }
29 }else{
30 warn "Arguments should start with -d or -o, invalid argument $arg would be ignored.\n";
31 }
32}
33
34if($hasCivlDir == 0){
35 warn "no civl directory is provided, current directory will be used as the civl directory.\n";
36}
37
38unless (-d $datOut) {
39 mkdir $datOut;
40}
41$benchOut="$datOut/$benchOut";
42
43my $scriptPrefix="$civlDir/scripts/scale";
44
45## Get last release version number ...
46my $lastReleaseVersion;
47
48opendir(my $scriptDir, "$scriptPrefix");
49while (readdir $scriptDir) {
50 if ($_ =~ (/^v(([0-9]+).([0-9]+).([0-9]*))_bench_dat$/)) {
51 $lastReleaseVersion = $1;
52 print "Benchmark running results of CIVL v$lastReleaseVersion found\n";
53 last;
54 }
55}
56
57print "running scale benchmarks...\n";
58my $cmd = `$scriptPrefix/runBenchScale.pl $civlDir -o$benchOut`;
59print "scale benchmarks finished, now generating .dat file in $datOut...\n";
60$cmd = `$scriptPrefix/parseScale.pl $benchOut $datOut`;
61print ".dat file finished, now generating figure...\n";
62
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/);
70 if($benchmark eq "Diningphilosopher"){
71 $benchmark="Dining philosopher";
72 }
73 print "plotting figure for benchmark $benchmark...\n";
74 if (defined $lastReleaseVersion) {
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`;
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 }
80}
81print "scaling figures is successfully generated in $datOut\n";
82#print "copy benchmark results to Ziqing's directory /home/ziqing ...";
83#$cmd = `cp -a $datDir /home/ziqing/ `;
84
85
86
Note: See TracBrowser for help on using the repository browser.