Changeset 1dfc3d0


Ignore:
Timestamp:
Apr 4, 2023, 1:17:44 PM (13 months ago)
Author:
Mike Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, master
Children:
b0be909f
Parents:
34b6a7b6
Message:

Tweak LL perf compilation--CLI to support a fixed-work mode that does not re-check clock() during the run.

Location:
doc/theses/mike_brooks_MMath/benchmarks/list
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/benchmarks/list/Makefile

    r34b6a7b6 r1dfc3d0  
    1212UXX =  ~/u++/u++-7.0.0/bin/u++
    1313
    14 MODE = performance
     14MODE=performance
     15EXTRA_COMP_FLAGS=
     16RUN_NUM_REPS=3
    1517RUNARGS=
    1618
     
    102104
    103105perfexp--% : driver--%.o observation.o
    104         $(COMPILER) $^ -o $@
     106        $(COMPILER) $(EXTRA_COMP_FLAGS) $^ -o $@
    105107
    106108driver--%.o : driver.c
    107         $(COMPILER) -c $< $(OP_DEFINES) -include op-$(OP).h -include fx-$(FX).h -o $@ -MMD
     109        $(COMPILER) $(EXTRA_COMP_FLAGS) -c $< $(OP_DEFINES) -include op-$(OP).h -include fx-$(FX).h -o $@ -MMD
     110
     111sayhi:
     112        echo $(PERFPROGS)
    108113
    109114
    110 
    111 
    112 RUN_NUM_REPS=3
    113115RUN_REP_IDS=$(shell echo {1..$(RUN_NUM_REPS)})              # 1 2 3
    114116RUN_REP_EXTS=$(call cross3,,run,$(RUN_REP_IDS),.1csv)       # run1.1csv run2.1cav run3.1csv
     
    146148.PRECIOUS: result--%.1csv driver--%.o perfexp--% %.o
    147149
    148 
    149150-include *.d
  • doc/theses/mike_brooks_MMath/benchmarks/list/driver.c

    r34b6a7b6 r1dfc3d0  
    1717
    1818#if defined(NDEBUG) || (defined(__cforall) && !defined(__CFA_DEBUG__))
    19     enum { DefaultNumNodes = 1000, DefaultExperimentDurSec = 1, DefaultCheckClockFreq = 1000, DefaultExperimentDurOpCount = -1 };
     19    enum { DefaultNumNodes = 1000, DefaultExperimentDurSec = 1, DefaultCheckDoneFreq = 1000, DefaultExperimentDurOpCount = -1 };
    2020    #define TRACE(tp)
    2121#else
    22     enum { DefaultNumNodes = 10, DefaultExperimentDurSec = 1, DefaultCheckClockFreq = 2, DefaultExperimentDurOpCount = 20 };
     22    enum { DefaultNumNodes = 10, DefaultExperimentDurSec = 1, DefaultCheckDoneFreq = 2, DefaultExperimentDurOpCount = 20 };
    2323    static const char * tp_filter
    2424    // = "";
     
    7272)
    7373
     74unsigned int uDefaultPreemption() {
     75        return 0;
     76}
     77
    7478int main(int argc, const char *argv[]) {
    7579
    7680
    77     const char * usage_args = "[ExperimentDurSec [CheckClockFreq [NumNodes [ExperimentDurOpCount]]]]";
     81    const char * usage_args = "[ExperimentDurSec [CheckDoneFreq [NumNodes [ExperimentDurOpCount]]]]";
    7882    const int static_arg_posns = 4;
    7983
    8084    unsigned int ExperimentDurSec     = DefaultExperimentDurSec;
    81     unsigned int CheckClockFreq       = DefaultCheckClockFreq;
     85    unsigned int CheckDoneFreq       = DefaultCheckDoneFreq;
    8286    unsigned int NumNodes             = DefaultNumNodes;
    8387    size_t       ExperimentDurOpCount = DefaultExperimentDurOpCount;
    8488
    85     switch ((argc < static_arg_posns) ? argc : static_arg_posns) {
    86       case 5: ExperimentDurOpCount = atoi(argv[4]);
    87       case 4: NumNodes = atoi(argv[3]);
    88       case 3: CheckClockFreq = atoi(argv[2]);
    89       case 2: ExperimentDurSec = atoi(argv[1]);
     89    switch (((argc - 1) < static_arg_posns) ? (argc - 1) : static_arg_posns) {
     90      case 4: ExperimentDurOpCount = atol(argv[4]);
     91      case 3: NumNodes = atoi(argv[3]);
     92      case 2: CheckDoneFreq = atoi(argv[2]);
     93      case 1: ExperimentDurSec = atoi(argv[1]);
    9094    }
    9195
    92     if (ExperimentDurSec == 0 || CheckClockFreq == 0 || NumNodes == 0 || ExperimentDurOpCount == 0 ) {
     96    if (ExperimentDurSec == 0 || CheckDoneFreq == 0 || NumNodes == 0 || ExperimentDurOpCount == 0 ) {
    9397        printf("usage: %s %s\n", argv[0], usage_args);
    9498        return -1;
    9599    }
     100
     101  #ifdef DISABLE_CLOCK_RECHECK
     102    if (ExperimentDurSec != -1) {
     103        printf("Error: experiment compiled as fixed-work only.  ExperimentDurSec (currently %d) must be set to -1.\nUsage: %s %s\n", ExperimentDurSec, argv[0], usage_args);
     104        return -1;
     105    }
     106  #endif
    96107
    97108    ui = (B_UserItem*) malloc( NumNodes * sizeof(B_UserItem) );
     
    100111    listedItems = (BFX_LISTED_ELEM_T(B_UserItem)*)malloc( NumNodes * sizeof(BFX_LISTED_ELEM_T(B_UserItem)) );
    101112    memset(listedItems, 0, NumNodes * sizeof(BFX_LISTED_ELEM_T(B_UserItem)));
     113
     114    printf("ui @ %p\nlistedItems @ %p\n\n", ui, listedItems);
    102115
    103116    for (int i = 0; i < NumNodes; i++) {
     
    130143
    131144    while (elapsed_sec <= (double) ExperimentDurSec && bobs_ops_completed < ExperimentDurOpCount) {
    132         for ( int t = 0; t < CheckClockFreq; t += 1 ) {
     145        for ( int t = 0; t < CheckDoneFreq; t += 1 ) {
    133146            TRACE('a')
    134147            listedItems[0] =
     
    166179            TRACE('g')
    167180        }
     181      #ifndef DISABLE_CLOCK_RECHECK
     182        clock_t end = clock();
     183        elapsed_sec = ((double)(end - start)) / ((double)CLOCKS_PER_SEC);
     184      #endif
     185    }
     186    #ifdef DISABLE_CLOCK_RECHECK
     187    {
    168188        clock_t end = clock();
    169189        elapsed_sec = ((double)(end - start)) / ((double)CLOCKS_PER_SEC);
    170190    }
     191    #endif
    171192
    172193    double mean_op_dur_ns = elapsed_sec / ((double)bobs_ops_completed) * 1000 * 1000 * 1000;
Note: See TracChangeset for help on using the changeset viewer.