Changeset 5f648fb3 for doc


Ignore:
Timestamp:
Mar 19, 2023, 1:51:35 PM (14 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
cd477ca
Parents:
0da7181
Message:

updated runscript and shared header for rand bench

Location:
doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/bench.h

    r0da7181 r5f648fb3  
    4747#endif
    4848
    49 size_t threads = 1;
     49size_t threads = 1, num_locks = -1;
    5050
    5151#define BENCH_START()                           \
    52         if ( argc > 2 ) exit( EXIT_FAILURE );   \
     52        if ( argc > 3 ) exit( EXIT_FAILURE );   \
    5353        if ( argc == 2 ) {                      \
    5454                threads = atoi( argv[1] );      \
     55        } else if ( argc == 3 ) {                       \
     56                threads = atoi( argv[1] );      \
     57        num_locks = atoi( argv[2] );    \
    5558        }
    5659
     
    7780}
    7881#endif
     82
     83// splitmix64 rand num generator
     84// https://rosettacode.org/wiki/Pseudo-random_numbers/Splitmix64
     85uint64_t state;                                  /* The state can be seeded with any (upto) 64 bit integer value. */
     86
     87uint64_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/run

    r0da7181 r5f648fb3  
    8585}
    8686
    87 numtimes=1
     87numtimes=11
    8888
    8989# locks=('-DLOCKS=L1' '-DLOCKS=L2' '-DLOCKS=L3' '-DLOCKS=L4' '-DLOCKS=L5' '-DLOCKS=L6' '-DLOCKS=L7' '-DLOCKS=L8')
     
    9292locks=('2' '4' '8')
    9393
    94 # num_threads='2 4 8 16 24 32'
    95 num_threads='2 4 8'
     94num_threads='2 4 8 16 24 32'
     95# num_threads='2 4 8'
    9696
    9797# toggle benchmarks
    9898order=${true}
     99rand=${true}
     100baseline=${true}
    99101
    100102runCFA=${true}
     
    156158
    157159if [ ${runCFA} -eq ${true} ] ; then
    158     echo -n 'CFA '
     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
    159169fi # done CFA
    160170if [ ${runCPP} -eq ${true} ] ; then
    161     echo -n 'CPP '
     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
    162180fi # done CPP
    163181echo ""
     
    174192
    175193run_order() {
    176     echo "order locks: "${1}
     194    echo "locks: "${1}
     195    post_args=${1}
    177196
    178197    if [ ${runCFA} -eq ${true} ] ; then
    179198        cd cfa # CFA RUN
    180         print_header 'CFA'${3}
    181         ${cfa} ${cfa_flags} ${2} order${3}.cfa -o a.${hostname} > /dev/null 2>&1
     199        print_header 'CFA-'${3}
     200        ${cfa} ${cfa_flags} ${2} ${3}.cfa -o a.${hostname} > /dev/null 2>&1
    182201        run_bench
    183202        rm a.${hostname}
     
    187206    if [ ${runCPP} -eq ${true} ] ; then
    188207        cd cpp # CPP RUN
    189         print_header 'CPP'${3}
    190         ${cpp} ${cpp_flags} ${2} order${3}.cc -o a.${hostname} > /dev/null 2>&1
     208        print_header 'CPP-'${3}
     209        ${cpp} ${cpp_flags} ${2} ${3}.cc -o a.${hostname} > /dev/null 2>&1
    191210        run_bench
    192211        rm a.${hostname}
     
    196215
    197216# /usr/bin/time -f "%Uu %Ss %Er %Mkb"
    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 
     217
     218for 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
     228done
     229
     230
Note: See TracChangeset for help on using the changeset viewer.