Changeset f03209d3


Ignore:
Timestamp:
Jan 5, 2021, 5:51:30 PM (10 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
4468a70, 587a608
Parents:
ed1a637
Message:

Locality benchmark now supports explicit number of spots instead of using nthreads - nprocs

Location:
benchmark/readyQ
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/locality.cfa

    red1a637 rf03209d3  
    184184        unsigned wsize = 2;
    185185        unsigned wcnt  = 2;
     186        unsigned nspots = 0;
    186187        bool share = false;
    187188        cfa_option opt[] = {
    188189                BENCH_OPT,
     190                { 'n', "nspots", "Number of spots where threads sleep (nthreads - nspots are active at the same time)", nspots},
    189191                { 'w', "worksize", "Size of the array for each threads, in words (64bit)", wsize},
    190192                { 'c', "workcnt" , "Number of words to touch when working (random pick, cells can be picked more than once)", wcnt },
     
    196198        unsigned long long global_gmigs = 0;
    197199        unsigned long long global_dmigs = 0;
     200
     201        if( nspots == 0 ) { nspots = nthreads - nprocs; }
    198202
    199203        Time start, end;
     
    205209                }
    206210
    207                 MySpot * spots[nthreads - nprocs];
    208                 for(i; nthreads - nprocs) {
     211                MySpot * spots[nspots];
     212                for(i; nspots) {
    209213                        spots[i] = malloc();
    210214                        (*spots[i]){ i };
     
    220224                                        data_arrays[i],
    221225                                        spots,
    222                                         nthreads - nprocs,
     226                                        nspots,
    223227                                        wcnt,
    224228                                        share,
     
    258262                }
    259263
    260                 for(i; nthreads - nprocs) {
     264                for(i; nspots) {
    261265                        ^( *spots[i] ){};
    262266                        free( spots[i] );
  • benchmark/readyQ/locality.cpp

    red1a637 rf03209d3  
    201201
    202202void thread_main( MyCtx & ctx ) {
    203         uint64_t state;
     203        uint64_t state = ctx.id;
    204204
    205205        // Wait for start
     
    237237        unsigned wsize = 2;
    238238        unsigned wcnt  = 2;
     239        unsigned nspots = 0;
    239240        bool share = false;
    240241        option_t opt[] = {
    241242                BENCH_OPT,
     243                { 'n', "nspots", "Number of spots where threads sleep (nthreads - nspots are active at the same time)", nspots},
    242244                { 'w', "worksize", "Size of the array for each threads, in words (64bit)", wsize},
    243245                { 'c', "workcnt" , "Number of words to touch when working (random pick, cells can be picked more than once)", wcnt },
     
    252254        unsigned long long global_gmigs = 0;
    253255        unsigned long long global_dmigs = 0;
     256
     257        if( nspots == 0 ) { nspots = nthreads - nprocs; }
    254258
    255259        uint64_t start, end;
     
    261265                }
    262266
    263                 MySpot * spots[nthreads - nprocs];
    264                 for(size_t i = 0; i < (nthreads - nprocs); i++) {
     267                MySpot * spots[nspots];
     268                for(unsigned i = 0; i < nspots; i++) {
    265269                        spots[i] = new MySpot{ i };
    266270                }
    267271
    268                 threads_left = nthreads;
     272                threads_left = nthreads - nspots;
    269273                Fibre * threads[nthreads];
    270274                MyCtx * thddata[nthreads];
     
    274278                                        data_arrays[i],
    275279                                        spots,
    276                                         nthreads - nprocs,
     280                                        nspots,
    277281                                        wcnt,
    278282                                        share,
     
    307311                }
    308312
    309                 for(size_t i = 0; i < (nthreads - nprocs); i++) {
     313                for(size_t i = 0; i < nspots; i++) {
    310314                        delete( spots[i] );
    311315                }
     
    315319        printf("Number of processors   : %'d\n", nprocs);
    316320        printf("Number of threads      : %'d\n", nthreads);
    317         printf("Total Operations(ops)  : %'15llu\n", global_count);
     321        printf("Number of spots        : %'d\n", nspots);
    318322        printf("Work size (64bit words): %'15u\n", wsize);
    319323        printf("Total Operations(ops)  : %'15llu\n", global_count);
    320324        printf("Total G Migrations     : %'15llu\n", global_gmigs);
    321325        printf("Total D Migrations     : %'15llu\n", global_dmigs);
    322         printf("Ops per second       : %'18.2lf\n", ((double)global_count) / to_fseconds(end - start));
    323         printf("ns per ops           : %'18.2lf\n", ((double)(end - start)) / global_count);
    324         printf("Ops per threads      : %'15llu\n", global_count / nthreads);
    325         printf("Ops per procs        : %'15llu\n", global_count / nprocs);
    326         printf("Ops/sec/procs        : %'18.2lf\n", (((double)global_count) / nprocs) / to_fseconds(end - start));
    327         printf("ns per ops/procs     : %'18.2lf\n", ((double)(end - start)) / (global_count / nprocs));
     326        printf("Ops per second         : %'18.2lf\n", ((double)global_count) / to_fseconds(end - start));
     327        printf("ns per ops             : %'18.2lf\n", ((double)(end - start)) / global_count);
     328        printf("Ops per threads        : %'15llu\n", global_count / nthreads);
     329        printf("Ops per procs          : %'15llu\n", global_count / nprocs);
     330        printf("Ops/sec/procs          : %'18.2lf\n", (((double)global_count) / nprocs) / to_fseconds(end - start));
     331        printf("ns per ops/procs       : %'18.2lf\n", ((double)(end - start)) / (global_count / nprocs));
    328332        fflush(stdout);
    329333}
  • benchmark/readyQ/locality.go

    red1a637 rf03209d3  
    221221func main() {
    222222        // Benchmark specific command line arguments
     223        nspotsOpt    := flag.Int   ("n", 0    , "Number of spots where threads sleep (nthreads - nspots are active at the same time)")
    223224        work_sizeOpt := flag.Uint64("w", 2    , "Size of the array for each threads, in words (64bit)")
    224225        countOpt     := flag.Uint64("c", 2    , "Number of words to touch when working (random pick, cells can be picked more than once)")
     
    229230
    230231        // Eval command line arguments
     232        nspots:= *nspotsOpt
    231233        size  := *work_sizeOpt
    232234        cnt   := *countOpt
    233235        share := *shareOpt
     236
     237        if nspots == 0 { nspots = nthreads - nprocs; }
    234238
    235239        // Check params
     
    241245        // Make global data
    242246        barrierStart := make(chan struct{})         // Barrier used at the start
    243         threads_left = int64(nprocs)                // Counter for active threads (not 'nthreads' because at all times 'nthreads - nprocs' are blocked)
     247        threads_left = int64(nthreads - nspots)                // Counter for active threads (not 'nthreads' because at all times 'nthreads - nprocs' are blocked)
    244248        result  := make(chan Result)                // Channel for results
    245         channels := make([]Spot, nthreads - nprocs) // Number of spots
     249        channels := make([]Spot, nspots) // Number of spots
    246250        for i := range channels {
    247251                channels[i] = Spot{[16]uint64{0},uintptr(0), i,[16]uint64{0}}     // init spots
  • benchmark/readyQ/locality.rs

    red1a637 rf03209d3  
    257257        let options = App::new("Locality Tokio")
    258258                .args(&bench::args())
    259                 .arg(Arg::with_name("size") .short("w").long("worksize").takes_value(true).default_value("2").help("Size of the array for each threads, in words (64bit)"))
    260                 .arg(Arg::with_name("work") .short("c").long("workcnt") .takes_value(true).default_value("2").help("Number of words to touch when working (random pick, cells can be picked more than once)"))
    261                 .arg(Arg::with_name("share").short("s").long("share")   .takes_value(true).default_value("true").help("Pass the work data to the next thread when blocking"))
     259                .arg(Arg::with_name("nspots").short("n").long("nspots")  .takes_value(true).default_value("0").help("Number of spots where threads sleep (nthreads - nspots are active at the same time)"))
     260                .arg(Arg::with_name("size")  .short("w").long("worksize").takes_value(true).default_value("2").help("Size of the array for each threads, in words (64bit)"))
     261                .arg(Arg::with_name("work")  .short("c").long("workcnt") .takes_value(true).default_value("2").help("Number of words to touch when working (random pick, cells can be picked more than once)"))
     262                .arg(Arg::with_name("share") .short("s").long("share")   .takes_value(true).default_value("true").help("Pass the work data to the next thread when blocking"))
    262263                .get_matches();
    263264
     
    267268        let wcnt       = options.value_of("work").unwrap().parse::<u64>().unwrap();
    268269        let share      = options.value_of("share").unwrap().parse::<bool>().unwrap();
     270        let nspots = {
     271                let val = options.value_of("nspots").unwrap().parse::<usize>().unwrap();
     272                if val != 0 {
     273                        val
     274                } else {
     275                        nthreads - nprocs
     276                }
     277        };
    269278
    270279        // Check params
     
    282291
    283292        let mut data_arrays : Vec<MyData> = (0..nthreads).map(|i| MyData::new(i, wsize)).rev().collect();
    284         let spots : Arc<Vec<MySpot>> = Arc::new((0..nthreads - nprocs).map(|i| MySpot::new(i)).rev().collect());
     293        let spots : Arc<Vec<MySpot>> = Arc::new((0..nspots).map(|i| MySpot::new(i)).rev().collect());
    285294        let barr = Arc::new(sync::Barrier::new(nthreads + 1));
    286295
Note: See TracChangeset for help on using the changeset viewer.