Ignore:
Timestamp:
Jun 14, 2016, 5:23:56 PM (8 years ago)
Author:
meunier
Message:
  • Improved scripts for simulations and graphes
  • Continued to clean up the lib nrc2 (from nrio2x.x to nrmem1.c)
  • Added a version (Fast - Parmerge - No stats)
Location:
soft/giet_vm/applications/rosenfeld/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/rosenfeld/scripts/create_graph.py

    r822 r823  
    1616import filecmp
    1717import random
     18import math
    1819
    1920from stack import Stack
     
    2324
    2425use_rand_images = True
    25 with_features = True
     26with_features = False
    2627
    27 threads = [1, 2, 4]
    28 nb_step = 0
     28threads = [1, 2, 4, 8, 16, 32, 64]
    2929use_dsk = True
    30 img_size = 1024
     30img_size = 2048
    3131granularity = 1
    3232rand_seed = 7
     
    4242# Each of these configuration must have been run with both features activated and deactivated
    4343configs = [
    44         {'SLOW':'1', 'FAST':'0', 'PARMERGE':'0', 'ARSP':'0'},
    45         {'SLOW':'0', 'FAST':'1', 'PARMERGE':'0', 'ARSP':'0'},
    4644        #{'SLOW':'1', 'FAST':'0', 'PARMERGE':'0', 'ARSP':'0'},
    4745        #{'SLOW':'0', 'FAST':'1', 'PARMERGE':'0', 'ARSP':'0'},
    4846        #{'SLOW':'0', 'FAST':'1', 'PARMERGE':'1', 'ARSP':'0'},
    49         #{'SLOW':'0', 'FAST':'1', 'PARMERGE':'1', 'ARSP':'1'},
     47        {'SLOW':'0', 'FAST':'1', 'PARMERGE':'1', 'ARSP':'1'},
    5048]
    5149
     
    5553    code = compile(f.read(), pyconf_file, 'exec')
    5654    exec(code)
     55
     56nb_step = 0
    5757
    5858if use_dsk:
     
    125125        plotter.add_x(X)
    126126        assert(nb_step == 4)
    127         YPAR1 = [float(exec_time[fconfig][thread]["NF"][density][0]) for density in range(0, 101)] # Parallel Labeling
    128         YPAR2 = [float(exec_time[fconfig][thread]["NF"][density][1]) for density in range(0, 101)] # Merging (Parallel or Pyramidal)
    129         YPTC2 = [float(exec_time[fconfig][thread]["NF"][density][2]) for density in range(0, 101)] # Parallel Transitive Closure
    130         YPAR3 = [float(exec_time[fconfig][thread]["NF"][density][3]) for density in range(0, 101)] # Parallel Relabeling
     127        YPAR1 = [float(int(exec_time[fconfig][thread]["NF"][density][0]) / math.pow(img_size, 2)) for density in range(0, 101)] # Parallel Labeling
     128        YPAR2 = [float(int(exec_time[fconfig][thread]["NF"][density][1]) / math.pow(img_size, 2)) for density in range(0, 101)] # Merging (Parallel or Pyramidal)
     129        YPTC2 = [float(int(exec_time[fconfig][thread]["NF"][density][2]) / math.pow(img_size, 2)) for density in range(0, 101)] # Parallel Transitive Closure
     130        YPAR3 = [float(int(exec_time[fconfig][thread]["NF"][density][3]) / math.pow(img_size, 2)) for density in range(0, 101)] # Parallel Relabeling
    131131
    132132        plotter.add_y(YPAR1)
     
    136136
    137137        if with_features:
    138             YPAR1f = [float(exec_time[fconfig][thread]["FT"][density][0]) for density in range(0, 101)] # Parallel Labeling
    139             YPAR2f = [float(exec_time[fconfig][thread]["FT"][density][1]) for density in range(0, 101)] # Merging (Parallel or Pyramidal)
     138            YPAR1f = [float(int(exec_time[fconfig][thread]["FT"][density][0]) / math.pow(img_size, 2)) for density in range(0, 101)] # Parallel Labeling
     139            YPAR2f = [float(int(exec_time[fconfig][thread]["FT"][density][1]) / math.pow(img_size, 2)) for density in range(0, 101)] # Merging (Parallel or Pyramidal)
    140140            deltaYPAR1 = [max(0, x - y) for x, y in zip (YPAR1f, YPAR1)]
    141141            deltaYPAR2 = [max(0, x - y) for x, y in zip (YPAR2f, YPAR2)]
  • soft/giet_vm/applications/rosenfeld/scripts/run_simus.py

    r822 r823  
    55# python 2 as it will execute on computation servers
    66
     7# TODO:
     8#       Can we do something about assert in perf eval?
    79
    810from __future__ import print_function
     
    3739
    3840# Parameters
    39 num_runs = 10
     41# - with eval_perf, num_internal_runs should be used, as this allows to mitigate the cost of the extra
     42#     run required to have the correct "ne" value (number of labels), and only the times from last application run are taken
     43# - With check_results, num_app_runs should be used, so as to have a number of checks equals to the number of runs,
     44#     because only one check per application run is performed
     45num_app_runs = 1        # Number of times the application is launched per configuration
     46num_internal_runs = 20  # Number of times the image is processed inside the application
    4047check_results = False
    4148eval_perf = True
    4249use_valgrind = False
    4350use_rand_images = True
    44 threads = [1, 2, 4]
     51threads = [1, 2, 4, 8, 16, 32, 64]
     52#threads = [1, 2]
    4553use_dsk = True
    4654# Using dsk will store generated random images, otherwise they are re-generated at each run to save disk space
     
    4856# Configurations
    4957configs = [
    50         {'SLOW':'1', 'FAST':'0', 'FEATURES':'0', 'PARMERGE':'0', 'ARSP':'0'},
    51         {'SLOW':'0', 'FAST':'1', 'FEATURES':'0', 'PARMERGE':'0', 'ARSP':'0'},
    52         {'SLOW':'1', 'FAST':'0', 'FEATURES':'1', 'PARMERGE':'0', 'ARSP':'0'},
    53         {'SLOW':'0', 'FAST':'1', 'FEATURES':'1', 'PARMERGE':'0', 'ARSP':'0'},
     58        #{'SLOW':'1', 'FAST':'0', 'FEATURES':'0', 'PARMERGE':'0', 'ARSP':'0'},
     59        #{'SLOW':'0', 'FAST':'1', 'FEATURES':'0', 'PARMERGE':'0', 'ARSP':'0'},
     60        #{'SLOW':'1', 'FAST':'0', 'FEATURES':'1', 'PARMERGE':'0', 'ARSP':'0'},
     61        #{'SLOW':'0', 'FAST':'1', 'FEATURES':'1', 'PARMERGE':'0', 'ARSP':'0'},
     62        {'SLOW':'0', 'FAST':'1', 'FEATURES':'0', 'PARMERGE':'1', 'ARSP':'0'},
    5463        #{'SLOW':'0', 'FAST':'1', 'FEATURES':'1', 'PARMERGE':'1', 'ARSP':'0'},
    5564        #{'SLOW':'0', 'FAST':'1', 'FEATURES':'0', 'PARMERGE':'1', 'ARSP':'1'},
     
    6069rand_seed = 7
    6170granularity = 1 # constant for now
    62 img_size = 1024
     71img_size = 2048
    6372
    6473check_pyconf_file(pyconf_file)
     
    93102
    94103
     104if check_results and eval_perf:
     105    print("*** Warning: check_results and eval_perf modes are both set\n")
     106if eval_perf and use_valgrind:
     107    print("*** Warning: using valgrind while eval_perf mode is set\n")
     108if eval_perf and num_app_runs != 1:
     109    print("*** Warning: using eval_perf with num_app_runs != 1\n")
     110if check_results and num_internal_runs != 1:
     111    print("*** Warning: using check_results with num_internal_runs != 1\n")
     112
     113
    95114
    96115def gen_random_image(filename, x, y, granularity, density, seed):
     
    136155                    break
    137156            if not line_with_key:
    138                 f.write(line)
     157                if "#define MCA_VERBOSE_LEVEL" in line:
     158                    if eval_perf:
     159                        verb_level = 1
     160                    else:
     161                        verb_level = 2
     162                    f.write("#define MCA_VERBOSE_LEVEL %d\n" % verb_level) 
     163                else:
     164                    f.write(line)
    139165
    140166        f.close()
     
    179205    my_chdir(top_path)
    180206    cmd = ['make']
     207    #if eval_perf:
     208    #    cmd.extend(['IGNORE_ASSERT=true'])
    181209    print_and_call(cmd)
    182210    my_chdir(scripts_path)
     
    205233        for nthreads in threads:
    206234            perf_array[fconfig][img_basename][nthreads] = {}
    207             for run in range(num_runs):
     235            for run in range(num_app_runs):
    208236                if not os.path.exists(ref_bmpfile):
    209237                    bmpfile = ref_bmpfile
     
    223251   
    224252                cmd.extend([short_path(binary_file), '-n', str(nthreads), '-i', short_path(image)])
     253
     254                if num_internal_runs > 1:
     255                    cmd.extend(['-r', str(num_internal_runs)])
    225256               
    226257                if check_results:
     
    236267
    237268                # if performance evaluation, get timing measurements
     269                # Only the last application run is considered
    238270                if eval_perf:
    239271                    for line in outlines:
     
    247279                            step = match.group(1)
    248280                            value = tokens[len(tokens) - 1]
    249                             if step in perf_array[fconfig][img_basename][nthreads]:
    250                                 # Accumulating times over the num_runs runs
    251                                 perf_array[fconfig][img_basename][nthreads][step] += int(value)
    252                             else:
    253                                 perf_array[fconfig][img_basename][nthreads][step] = int(value)
     281                            perf_array[fconfig][img_basename][nthreads][step] = int(value)
    254282
    255283
     
    315343                for step in sorted(perf_array[fconfig][img_basename][nthreads].keys()):
    316344                    # Average time for each step
    317                     file.write("[STEP_%s]   %d\n" % (step, perf_array[fconfig][img_basename][nthreads][step] / num_runs))
     345                    file.write("[STEP_%s]   %d\n" % (step, perf_array[fconfig][img_basename][nthreads][step]))
    318346
    319347        img_idx += 1
Note: See TracChangeset for help on using the changeset viewer.