-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrbtreetestscript.pl
180 lines (150 loc) · 6.25 KB
/
rbtreetestscript.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/env perl
#
# Copyright (C) 2011
# University of Rochester Department of Computer Science
# and
# Lehigh University Department of Computer Science and Engineering
#
# License: Modified BSD
# Please see the file LICENSE.RSTM for licensing information
#######################################################
#
# Begin User-Specified Configuration Fields
#
#######################################################
use Cwd;
# Names of the microbenchmarks that we want to test. Note that all
# configuration, other than thread count, goes into this string
@Benches = ("redblacktree"#"vacation/vacationSTM64 -n2 -q90 -u98 -r1048576 -t4194304 -c"
#,"yada",
#"genome","intruder","labyrinth","ssca2"
#kmeans, vacation
);
# Names of the STM algorithms that we want to test. Note that you must
# consider semantics yourself... our policies don't add that support after
# the fact. So in this case, we're using 'no semantics'
@Algs = ("NOrecno"
#,"NOrecHTBOT SPEC_TXS=2"#("NOrec", "NOrecno", "NOrecHTBOT SPEC_TXS=1", "NOrecHTBOT SPEC_TXS=2", "NOrecHTBOT SPEC_TXS=4" #("LLT", "Swiss", "NOrec");#, "NOrecHT SPEC_TXS=1", "NOrecHT SPEC_TXS=2", "NOrecHT SPEC_TXS=4", "NOrecHTBOT SPEC_TXS=1", "NOrecHTBOT SPEC_TXS=2", "NOrecHTBOT SPEC_TXS=4", NOrecHTO);
#,"NOrecHTBOT SPEC_TXS=1 WPH=2", "NOrecHTBOT SPEC_TXS=2 WPH=2", "NOrecHTBOT SPEC_TXS=4 WPH=2"
#,"NOrecHTBOT SPEC_TXS=1 WPH=3", "NOrecHTBOT SPEC_TXS=2 WPH=3", "NOrecHTBOT SPEC_TXS=4 WPH=3"
#,"NOrecHTBOT SPEC_TXS=1 WPH=7", "NOrecHTBOT SPEC_TXS=2 WPH=7", "NOrecHTBOT SPEC_TXS=4 WPH=7"
);
#@Algs = ("NOrec");
# Maximum thread count
$MaxThreadCount = 10;
# Average or Max behavior. "ProfileAppMax" is deprecated.
$ProfileBehavior = "ProfileAppAvg";
# Path to executables
$ExePath = "/home/joaobarreto/stamp-master/datastructures/";
# Average of how many trials?
$Trials = 3;
# LD_PRELOAD configuration (e.g., to use libhoard on Linux)
$LDP = "";
#######################################################
#
# End User-Specified Configuration Fields
#
#######################################################
## Note: Nothing below this point should need editing
# Make sure we have exactly one parameter: a file for output
die "You should provide a single argument indicating the name of the output file\n" unless $#ARGV == 0;
# open the output file and print a header
$outfile = $ARGV[0];
open (QTABLE, ">$outfile");
print QTABLE "#BM,threads";
#foreach $a (@Algs) {
print QTABLE ",time, normal time, abort time, pft time, pft normal time, pft prefetch time, pft abort time";
#}
print QTABLE "\n";
# Run all tests
foreach $b (@Benches) {
# print a message to update on progress, since this can take a while...
print "Testing ${ExePath}${b}\n";
# convert current config into a (hopefully unique) string
$curr_b = $b;
$curr_b =~ s/ //g;
# get the single-thread characterization of the workload
#$cbrline = `LD_PRELOAD=$LDP STM_CONFIG=$ProfileBehavior ${ExePath}${b} -p1 | tail -1`;
#chomp($cbrline);
#$cbrline =~ s/ #//g;
chdir("${ExePath}${b}");
# now for each thread
for ($p = 1; $p <= $MaxThreadCount; $p+=1) {
print "Testing at $p thread(s): ";
$line = "$curr_b, $p";
# test each algorithm
#foreach $a (@Algs) {
#print "\nTesting $a\n";
# run a few trials, get the average
$valtime = 0;
$valgnt = 0;
$valgat = 0;
for ($t = 0; $t < $Trials; $t++) {
print ".";
@res = `HTM_STATS=yes ./$b.htm_ibm -i 2048 -r 2048 -d 10000000 -u 100 -n $p`;
if((grep /Time/ , @res)){
@restime = grep /Time =/ , @res;
$restime[0] =~ s/.*Time =//;
$valtime += $restime[0];
@resgnt = grep /#HTM_STATS global_normal_time/ , @res;
$resgnt[0] =~ s/.*#HTM_STATS global_normal_time//;
$valgnt += int($resgnt[0]);
@resgat = grep /#HTM_STATS global_abort_time/ , @res;
$resgat[0] =~ s/.*#HTM_STATS global_abort_time//;
$valgat += int($resgat[0]);
} else {
$t--;
}
}
$valtime /= $Trials;
$valtime = sprintf "%.2f" , $valtime;
$valgnt /= $Trials;
$valgnt = int($valgnt);
$valgat /= $Trials;
$valgat = int($valgat);
# add this test to the qtable: must remove all spaces
$line .=",$valtime,$valgnt,$valgat";
#$valtime = 0;
#$valgnt = 0;
#$valgpt = 0;
#$valgat = 0;
#for ($t = 0; $t < $Trials; $t++) {
# print ".";
# @res = `HTM_STATS=yes PREFETCHING=yes make -f Makefile.htm_ibm runlow$p`;
# if((grep /Time/ , @res)){
# @restime = grep /Time =/ , @res;
# $restime[0] =~ s/.*Time =//;
# $valtime += $restime[0];
# @resgnt = grep /#HTM_STATS global_normal_time/ , @res;
# $resgnt[0] =~ s/.*#HTM_STATS global_normal_time//;
# $valgnt += int($resgnt[0]);
# @resgpt = grep /#HTM_STATS global_prefetch_time/ , @res;
# $resgpt[0] =~ s/.*#HTM_STATS global_prefetch_time//;
# $valgpt += int($resgpt[0]);
# @resgat = grep /#HTM_STATS global_abort_time/ , @res;
# $resgat[0] =~ s/.*#HTM_STATS global_abort_time//;
# $valgat += int($resgat[0]);
# } else {
# $t--;
# }
#}
#$valtime /= $Trials;
# $valtime = sprintf "%.2f" , $valtime;
#$valgnt /= $Trials;
#$valgnt = int($valgnt);
#$valgpt /= $Trials;
#$valgpt = int($valgpt);
#$valgat /= $Trials;
#$valgat = int($valgat);
# add this test to the qtable: must remove all spaces
# $line .=",$valtime,$valgnt,$valgpt,$valgat";
# }
print $line;
$line.="\n";
$line =~ s/ //g;
print QTABLE "$line";
print "\n";
`cd ~`;
}
}
close(QTABLE);