Changes in / [eac318a:60e14fc]
- Location:
- doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt
- Files:
-
- 2 added
- 4 deleted
- 3 edited
-
bench.h (modified) (2 diffs)
-
cfa/baseline.cfa (deleted)
-
cfa/order-basic.cfa (added)
-
cfa/order.cfa (modified) (2 diffs)
-
cfa/rand.cfa (deleted)
-
cpp/baseline.cc (deleted)
-
cpp/order-basic.cc (added)
-
cpp/rand.cc (deleted)
-
run (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/bench.h
reac318a r60e14fc 47 47 #endif 48 48 49 size_t threads = 1 , num_locks = -1;49 size_t threads = 1; 50 50 51 51 #define BENCH_START() \ 52 if ( argc > 3) exit( EXIT_FAILURE ); \52 if ( argc > 2 ) exit( EXIT_FAILURE ); \ 53 53 if ( argc == 2 ) { \ 54 54 threads = atoi( argv[1] ); \ 55 } else if ( argc == 3 ) { \56 threads = atoi( argv[1] ); \57 num_locks = atoi( argv[2] ); \58 55 } 59 56 … … 80 77 } 81 78 #endif 82 83 // splitmix64 rand num generator84 // https://rosettacode.org/wiki/Pseudo-random_numbers/Splitmix6485 uint64_t state; /* The state can be seeded with any (upto) 64 bit integer value. */86 87 uint64_t next_int() {88 state += 0x9e3779b97f4a7c15; /* increment the state variable */89 uint64_t z = state; /* copy the state to a working variable */90 z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; /* xor the variable with the variable right bit shifted 30 then multiply by a constant */91 z = (z ^ (z >> 27)) * 0x94d049bb133111eb; /* xor the variable with the variable right bit shifted 27 then multiply by a constant */92 return z ^ (z >> 31); /* return the variable xored with itself right bit shifted 31 */93 }94 -
doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/cfa/order.cfa
reac318a r60e14fc 10 10 uint64_t total = 0; 11 11 thread worker {}; 12 static inline void ?{}( worker & this, cluster & clu ) {13 ((thread &)this){ clu };14 }15 12 void main( worker & w ) { 16 13 BENCH( mutex ( LOCKS ) { }, total, done ) … … 19 16 int main( int argc, char * argv[] ) { 20 17 BENCH_START() 21 cluster clus; 22 processor * proc[threads]; 23 for ( i; threads ) // create procs 24 (*(proc[i] = alloc())){clus}; 25 26 worker * w[threads]; 27 for ( i; threads ) // create threads 28 (*(w[i] = alloc())){ clus }; 29 30 sleep( 10`s ); 31 done = true; 32 33 for ( i; threads ) // delete threads 34 delete(w[i]); 35 36 for ( i; threads ) // delete procs 37 delete(proc[i]); 18 processor p[threads]; // one extra for main thread 19 { 20 worker w[threads]; 21 sleep( 10`s ); 22 done = true; 23 } 38 24 printf( "%lu\n", total ); 39 25 } -
doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/run
reac318a r60e14fc 85 85 } 86 86 87 numtimes=1 187 numtimes=1 88 88 89 89 # locks=('-DLOCKS=L1' '-DLOCKS=L2' '-DLOCKS=L3' '-DLOCKS=L4' '-DLOCKS=L5' '-DLOCKS=L6' '-DLOCKS=L7' '-DLOCKS=L8') … … 92 92 locks=('2' '4' '8') 93 93 94 num_threads='2 4 8 16 24 32'95 #num_threads='2 4 8'94 # num_threads='2 4 8 16 24 32' 95 num_threads='2 4 8' 96 96 97 97 # toggle benchmarks 98 98 order=${true} 99 rand=${true}100 baseline=${true}101 99 102 100 runCFA=${true} … … 158 156 159 157 if [ ${runCFA} -eq ${true} ] ; then 160 if [ ${order} -eq ${true} ] ; then 161 echo -n 'CFA-order ' 162 fi 163 if [ ${baseline} -eq ${true} ] ; then 164 echo -n 'CFA-baseline ' 165 fi 166 if [ ${rand} -eq ${true} ] ; then 167 echo -n 'CFA-rand ' 168 fi 158 echo -n 'CFA ' 169 159 fi # done CFA 170 160 if [ ${runCPP} -eq ${true} ] ; then 171 if [ ${order} -eq ${true} ] ; then 172 echo -n 'CPP-order ' 173 fi 174 if [ ${baseline} -eq ${true} ] ; then 175 echo -n 'CPP-baseline ' 176 fi 177 if [ ${rand} -eq ${true} ] ; then 178 echo -n 'CPP-rand ' 179 fi 161 echo -n 'CPP ' 180 162 fi # done CPP 181 163 echo "" … … 192 174 193 175 run_order() { 194 echo "locks: "${1} 195 post_args=${1} 176 echo "order locks: "${1} 196 177 197 178 if [ ${runCFA} -eq ${true} ] ; then 198 179 cd cfa # CFA RUN 199 print_header 'CFA -'${3}200 ${cfa} ${cfa_flags} ${2} ${3}.cfa -o a.${hostname} > /dev/null 2>&1180 print_header 'CFA'${3} 181 ${cfa} ${cfa_flags} ${2} order${3}.cfa -o a.${hostname} > /dev/null 2>&1 201 182 run_bench 202 183 rm a.${hostname} … … 206 187 if [ ${runCPP} -eq ${true} ] ; then 207 188 cd cpp # CPP RUN 208 print_header 'CPP -'${3}209 ${cpp} ${cpp_flags} ${2} ${3}.cc -o a.${hostname} > /dev/null 2>&1189 print_header 'CPP'${3} 190 ${cpp} ${cpp_flags} ${2} order${3}.cc -o a.${hostname} > /dev/null 2>&1 210 191 run_bench 211 192 rm a.${hostname} … … 215 196 216 197 # /usr/bin/time -f "%Uu %Ss %Er %Mkb" 217 218 for i in ${!locks[@]}; do 219 if [ ${order} -eq ${true} ] ; then 220 run_order ${locks[$i]} ${lock_flags[$i]} 'order' 221 fi 222 if [ ${baseline} -eq ${true} ] ; then 223 run_order ${locks[$i]} ${lock_flags[$i]} 'baseline' 224 fi 225 if [ ${rand} -eq ${true} ] ; then 226 run_order ${locks[$i]} '-DLOCKS=L8' 'rand' 227 fi 228 done 229 230 198 if [ ${order} -eq ${true} ] ; then 199 for i in ${!locks[@]}; do 200 run_order ${locks[$i]} ${lock_flags[$i]} '' 201 run_order ${locks[$i]} ${lock_flags[$i]} '-basic' 202 done 203 fi 204
Note:
See TracChangeset
for help on using the changeset viewer.