source: CIVL/scripts/scale/run.pl@ 890ec0f

1.23 2.0 main test-branch
Last change on this file since 890ec0f was 4723002, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

fixed scaling experiments scripts

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

  • Property mode set to 100755
File size: 1.7 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;
15
16for(my $i=0; $i < $numArgs; $i++){
17 my $arg = $ARGV[$i];
18
19 if($arg =~ /^\-d(.*)$/){
20 $civlDir=$1;
21 $hasCivlDir=1;
22 }elsif ($arg =~ /^\-o(.*)$/){
23 $datOut = $1;
24 #if(!($datOut =~ /\.pdf$/)){
25 #warn "$out is not a pdf file name, $out.pdf will be used for output file instead.\n";
26 # $out="$out.pdf";
27 # }
28 }else{
29 warn "Arguments should start with -d or -o, invalid argument $arg would be ignored.\n";
30 }
31}
32
33if($hasCivlDir == 0){
34 warn "no civl directory is provided, current directory will be used as the civl directory.\n";
35}
36
37unless (-d $datOut) {
38 mkdir $datOut;
39}
40$benchOut="$datOut/$benchOut";
41
42my $scriptPrefix="$civlDir/scripts/scale";
43
44print "running scale benchmarks...\n";
45my $cmd = `$scriptPrefix/runBenchScale.pl $civlDir -o$benchOut`;
46print "scale benchmarks finished, now generating .dat file in $datOut...\n";
47$cmd = `$scriptPrefix/parseScale.pl $benchOut $datOut`;
48print ".dat file finished, now generating figure...\n";
49
50$datDir=dir("$datOut");
51while(my $datFile = $datDir->next){
52 next unless ($datFile =~ /\.dat$/);
53 my $benchmark;
54
55 $datFile = basename($datFile, "");
56 ($benchmark) = ($datFile =~ /(.*)\.dat/);
57 print "plotting figure for benchmark $benchmark...\n";
58 $cmd = `gnuplot -e "TITLE='$benchmark'" -e "DAT_FILE='$datOut/$datFile'" -e "OUT_FILE='$datOut/$benchmark.pdf'" $scriptPrefix/plotBench.plg`;
59}
60print "scaling figures is successfully generated in $datOut\n";
Note: See TracBrowser for help on using the repository browser.