Ignore:
Timestamp:
Jan 5, 2021, 5:51:30 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4468a70, 587a608
Parents:
ed1a6374
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/locality.cpp

    red1a6374 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}
Note: See TracChangeset for help on using the changeset viewer.