Beispiel #1
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    cycle_type = app_data['cycle']
    if cycle_type == 'V':
        mg = v_cycle(app_data)
    elif cycle_type == 'W':
        mg = w_cycle(app_data)

    app_name = app_data['cycle_name']
    live_outs = [mg]
    n = pipe_data['n']
    param_estimates = [(n, app_data['n'])]
    param_constraints = [ Condition(n, '==', app_data['n']) ]
    dst_path = "/tmp"

    group_size_configs = [3, 4, 5, 6, 7, 8]

    tile_size_configs = []

    tile_size_configs.append([8, 8, 8])
    tile_size_configs.append([8, 8, 16])

    tile_size_configs.append([8, 8, 32])
    tile_size_configs.append([8, 8, 64])
    tile_size_configs.append([8, 16, 16])
    tile_size_configs.append([8, 16, 32])
    tile_size_configs.append([8, 16, 64])
    tile_size_configs.append([8, 32, 32])
    tile_size_configs.append([8, 32, 64])
    tile_size_configs.append([8, 64, 64])

    tile_size_configs.append([16, 16, 16])
    tile_size_configs.append([16, 16, 32])
    tile_size_configs.append([16, 16, 64])
    tile_size_configs.append([16, 32, 32])
    tile_size_configs.append([16, 32, 64])
    tile_size_configs.append([16, 64, 64])

    tile_size_configs.append([32, 32, 32])
    tile_size_configs.append([32, 32, 64])
    tile_size_configs.append([32, 64, 64])
    tile_size_configs.append([64, 64, 64])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']
    if app_data['multipar']:
        opts += ['multipar']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {"_tuner_app_name": app_name,
                  "_tuner_live_outs": live_outs,
                  "_tuner_param_constraints": param_constraints, #optional
                  "_tuner_param_estimates": param_estimates, #optional
                  "_tuner_tile_size_configs": tile_size_configs, #optional
                  "_tuner_group_size_configs": group_size_configs, #optional
                  "_tuner_opts": opts, #optional
                  "_tuner_dst_path" : dst_path, # optional
                  "_tuner_cxx_string" : cxx_string, # optional
                  "_tuner_root_path" : ROOT, # needed if pool_alloc is set
                  "_tuner_debug_flag": True, # optional
                  "_tuner_opt_datadict": app_data
                 }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)


    # Execute the generated variants
    # ==============================

    exec_config = {"_tuner_app_name": app_name,
                   "_tuner_pipe": _tuner_pipe,
                   "_tuner_src_path": _tuner_src_path, # optional
                   "_tuner_configs_count": _tuner_configs_count, # optional
                   "_tuner_omp_threads": 4, # optional
                   "_tuner_nruns": 1, # optional
                   "_tuner_debug_flag": True, # optional
                   "_tuner_custom_executor": minimal_exec_mg,
                   "_tuner_app_data": app_data
                  }

    tuner.execute(exec_config)
Beispiel #2
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    app_name = app_data['app_name']
    pipe_name = app_data['app']
    pipe_func_name = "pipeline_" + pipe_name

    out_unsharp, inline_func = unsharp_mask(pipe_data)
    live_outs = [out_unsharp]

    R = pipe_data['R']
    C = pipe_data['C']

    rows = app_data['rows'] - 2
    cols = app_data['cols'] - 2
    threshold = app_data['threshold']
    weight = app_data['weight']

    param_estimates = [(R, rows), (C, cols)]
    param_constraints = [ Condition(R, "==", rows), \
                          Condition(C, "==", cols) ]

    dst_path = "/tmp"

    group_size_configs = [int(i * 4) for i in [0.2, 0.4, 0.5]]

    #group_size_configs = [10]

    tile_size_configs = []

    tile_size_configs.append([64, 256])
    tile_size_configs.append([64, 128])

    tile_size_configs.append([32, 512])
    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 64])

    tile_size_configs.append([16, 512])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 64])

    tile_size_configs.append([8, 512])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 64])
    tile_size_configs.append([8, 32])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']
    if app_data['dpfuse']:
        opts += ['dpfuse']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {
        "_tuner_app_name": app_name,
        "_tuner_live_outs": live_outs,
        "_tuner_param_constraints": param_constraints,  #optional
        "_tuner_param_estimates": param_estimates,  #optional
        "_tuner_tile_size_configs": tile_size_configs,  #optional
        "_tuner_group_size_configs": group_size_configs,  #optional
        "_tuner_opts": opts,  #optional
        "_tuner_dst_path": dst_path,  # optional
        "_tuner_cxx_string": cxx_string,  # optional
        "_tuner_root_path": ROOT,  # needed if pool_alloc is set
        "_tuner_debug_flag": True,  # optional
        "_tuner_opt_datadict": app_data
    }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)
    '''
    _tuner_src_path = '/tmp/PolycNUUEYoLt2Mage'
    _tuner_configs_count = 75
    _tuner_pipe = buildPipeline(live_outs)
    '''

    img_data = app_data['img_data']
    IN = img_data['IN']
    OUT = img_data['OUT']

    pipe_args = {}
    pipe_args['R'] = rows
    pipe_args['C'] = cols
    pipe_args['threshold'] = threshold
    pipe_args['weight'] = weight
    pipe_args['img'] = IN
    pipe_args['mask'] = OUT

    # Execute the generated variants
    # ==============================

    exec_config = {
        "_tuner_app_name": app_name,
        "_tuner_pipe": _tuner_pipe,
        "_tuner_pipe_arg_data": pipe_args,
        "_tuner_src_path": _tuner_src_path,  # optional
        "_tuner_configs_count": _tuner_configs_count,  # optional
        "_tuner_omp_threads": 4,  # optional
        "_tuner_nruns": int(app_data['app_args'].runs),  # optional
        "_tuner_debug_flag": True,  # optional
        #"_tuner_custom_executor": minimal_exec_mg,
        "_tuner_app_data": app_data
    }

    tuner.execute(exec_config)
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    app_name = app_data['app']
    pipe_name = app_data['app']

    out_campipe, iniline_fn = camera_pipe(pipe_data)
    live_outs = [out_campipe]

    R = pipe_data['R']
    C = pipe_data['C']

    rows = app_data['rows']
    cols = app_data['cols']

    param_estimates = [(R, rows), (C, cols)]
    param_constraints = [ Condition(R, "==", rows), \
                          Condition(C, "==", cols) ]

    dst_path = "/tmp"

    group_size_configs = [4, 8, 12, 16, 100]

    tile_size_configs = []

    tile_size_configs.append([64, 256])
    tile_size_configs.append([64, 128])

    tile_size_configs.append([32, 512])

    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 64])

    tile_size_configs.append([16, 512])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 64])

    tile_size_configs.append([8, 512])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 64])
    tile_size_configs.append([8, 32])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {
        "_tuner_app_name": app_name,
        "_tuner_pipe_name": pipe_name,  # optional
        "_tuner_live_outs": live_outs,
        "_tuner_param_constraints": param_constraints,  #optional
        "_tuner_param_estimates": param_estimates,  #optional
        "_tuner_tile_size_configs": tile_size_configs,  #optional
        "_tuner_group_size_configs": group_size_configs,  #optional
        "_tuner_opts": opts,  #optional
        "_tuner_dst_path": dst_path,  # optional
        "_tuner_cxx_string": cxx_string,  # optional
        "_tuner_root_path": ROOT,  # needed if pool_alloc is set
        "_tuner_debug_flag": True,  # optional
        "_tuner_opt_datadict": app_data
    }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)
    '''
    _tuner_src_path = '/tmp/PolyEzSz1jRLRPMage/'
    _tuner_configs_count = 75
    _tuner_pipe = buildPipeline(live_outs)
    '''

    img_data = app_data['img_data']
    IN = img_data['IN']
    OUT = img_data['OUT']
    M3200 = img_data['M3200']
    M7000 = img_data['M7000']

    app_args = app_data['app_args']
    colour_temp = float(app_args.colour_temp)
    contrast = float(app_args.contrast)
    gamma = float(app_args.gamma)

    pipe_args = {}
    pipe_args['R'] = rows
    pipe_args['C'] = cols
    pipe_args['colour_temp'] = colour_temp
    pipe_args['contrast'] = contrast
    pipe_args['gamma'] = gamma
    pipe_args['matrix_3200'] = M3200
    pipe_args['matrix_7000'] = M7000
    pipe_args['img'] = IN
    pipe_args['process'] = OUT

    # Execute the generated variants
    # ==============================

    exec_config = {
        "_tuner_app_name": app_name,
        "_tuner_pipe_name": pipe_name,  # optional
        "_tuner_pipe": _tuner_pipe,
        "_tuner_pipe_arg_data": pipe_args,
        "_tuner_src_path": _tuner_src_path,  # optional
        "_tuner_configs_count": _tuner_configs_count,  # optional
        "_tuner_omp_threads": 4,  # optional
        "_tuner_nruns": 1,  # optional
        "_tuner_debug_flag": True,  # optional
        #"_tuner_custom_executor": minimal_exec_mg,
        "_tuner_app_data": app_data
    }

    tuner.execute(exec_config)
Beispiel #4
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    app_name = app_data['app']
    pipe_name = app_data['app']

    out_pyramid = pyramid_blending(pipe_data)
    live_outs = [out_pyramid]
    
    R = pipe_data['R']
    C = pipe_data['C']

    rows = app_data['rows']-2
    cols = app_data['cols']-2

    param_estimates = [(R, rows), (C, cols)]
    param_constraints = [ Condition(R, "==", rows), \
                          Condition(C, "==", cols) ]
    
    dst_path = "/tmp"

    group_size_configs = [3, 5, 7, 9, 10]

    tile_size_configs = []

    tile_size_configs.append([64, 256])
    tile_size_configs.append([64, 128])
    
    tile_size_configs.append([32, 512])
    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 64])

    tile_size_configs.append([16, 512])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 64])

    tile_size_configs.append([8, 512])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 64])
    tile_size_configs.append([8, 32])
    
    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {"_tuner_app_name": app_name,
                  "_tuner_live_outs": live_outs,
                  "_tuner_param_constraints": param_constraints, #optional
                  "_tuner_param_estimates": param_estimates, #optional
                  "_tuner_tile_size_configs": tile_size_configs, #optional
                  "_tuner_group_size_configs": group_size_configs, #optional
                  "_tuner_opts": opts, #optional
                  "_tuner_dst_path" : dst_path, # optional
                  "_tuner_cxx_string" : cxx_string, # optional
                  "_tuner_root_path" : ROOT, # needed if pool_alloc is set
                  "_tuner_debug_flag": True, # optional
                  "_tuner_opt_datadict": app_data
                 }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)


    img_data = app_data['img_data']
    IN1 = img_data['IN1']
    IN2 = img_data['IN2']
    OUT = img_data['OUT']
    mask = img_data['mask_ghost'] 

    pipe_args = {}
    pipe_args['R'] = rows
    pipe_args['C'] = cols
    pipe_args['img1'] = IN1
    pipe_args['img2'] = IN2
    pipe_args['mask'] = mask
    pipe_args['blend'] = OUT 


    # Execute the generated variants
    # ==============================

    exec_config = {"_tuner_app_name": app_name,
                   "_tuner_pipe": _tuner_pipe,
                   "_tuner_pipe_arg_data": pipe_args,
                   "_tuner_src_path": _tuner_src_path, # optional
                   "_tuner_configs_count": _tuner_configs_count, # optional
                   "_tuner_omp_threads": 4, # optional
                   "_tuner_nruns": 1, # optional
                   "_tuner_debug_flag": True, # optional
                   #"_tuner_custom_executor": minimal_exec_mg,
                   "_tuner_app_data": app_data
                  }

    tuner.execute(exec_config)
Beispiel #5
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']
    app_name = app_data['app']

    stencil = stencil_jacobi(app_data)

    live_outs = [stencil]
    N = pipe_data['N']
    param_estimates = [(N, app_data['N'])]
    param_constraints = [ Condition(N, '==', app_data['N']) ]
    dst_path = "/tmp"

    group_size_configs = [2, 4, 6, 8]

    tile_size_configs = []
    tile_size_configs.append([8, 32])
    tile_size_configs.append([8, 64])

    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 512])

    tile_size_configs.append([16, 64])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 512])

    tile_size_configs.append([32, 64])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 512])

    tile_size_configs.append([64, 128])
    tile_size_configs.append([64, 256])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']
    if app_data['multipar']:
        opts += ['multipar']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {"_tuner_app_name": app_name,
                  "_tuner_live_outs": live_outs,
                  "_tuner_param_constraints": param_constraints, #optional
                  "_tuner_param_estimates": param_estimates, #optional
                  "_tuner_tile_size_configs": tile_size_configs, #optional
                  "_tuner_group_size_configs": group_size_configs, #optional
                  "_tuner_opts": opts, #optional
                  "_tuner_dst_path" : dst_path, # optional
                  "_tuner_cxx_string" : cxx_string, # optional
                  "_tuner_root_path" : ROOT, # needed if pool_alloc is set
                  "_tuner_debug_flag": True, # optional
                  "_tuner_opt_datadict": app_data
                 }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)

    # Execute the generated variants
    # ==============================

    exec_config = {"_tuner_app_name": app_name,
                   "_tuner_pipe": _tuner_pipe,
                   "_tuner_src_path": _tuner_src_path, # optional
                   "_tuner_configs_count": _tuner_configs_count, # optional
                   "_tuner_omp_threads": 4, # optional
                   "_tuner_nruns": 1, # optional
                   "_tuner_debug_flag": True, # optional
                   "_tuner_custom_executor": custom_exec_jacobi,
                   "_tuner_app_data": app_data
                  }

    tuner.execute(exec_config)
Beispiel #6
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    cycle_type = app_data['cycle']
    if cycle_type == 'V':
        mg = v_cycle(app_data)
    elif cycle_type == 'W':
        mg = w_cycle(app_data)

    app_name = app_data['cycle_name']
    live_outs = [mg]
    n = pipe_data['n']
    param_estimates = [(n, app_data['n'])]
    param_constraints = [ Condition(n, '==', app_data['n']) ]
    dst_path = "/tmp"

    group_size_configs = [2, 4, 6, 8]

    tile_size_configs = []
    tile_size_configs.append([8, 32])
    tile_size_configs.append([8, 64])

    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 512])

    tile_size_configs.append([16, 64])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 512])

    tile_size_configs.append([32, 64])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 512])

    tile_size_configs.append([64, 128])
    tile_size_configs.append([64, 256])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']
    if app_data['multipar']:
        opts += ['multipar']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {"_tuner_app_name": app_name,
                  "_tuner_live_outs": live_outs,
                  "_tuner_param_constraints": param_constraints, #optional
                  "_tuner_param_estimates": param_estimates, #optional
                  "_tuner_tile_size_configs": tile_size_configs, #optional
                  "_tuner_group_size_configs": group_size_configs, #optional
                  "_tuner_opts": opts, #optional
                  "_tuner_dst_path" : dst_path, # optional
                  "_tuner_cxx_string" : cxx_string, # optional
                  "_tuner_root_path" : ROOT, # needed if pool_alloc is set
                  "_tuner_debug_flag": True, # optional
                  "_tuner_opt_datadict": app_data
                 }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)


    # Execute the generated variants
    # ==============================

    exec_config = {"_tuner_app_name": app_name,
                   "_tuner_pipe": _tuner_pipe,
                   "_tuner_src_path": _tuner_src_path, # optional
                   "_tuner_configs_count": _tuner_configs_count, # optional
                   "_tuner_omp_threads": 48, # optional
                   "_tuner_nruns": 1, # optional
                   "_tuner_debug_flag": True, # optional
                   "_tuner_custom_executor": minimal_exec_mg,
                   "_tuner_app_data": app_data
                  }

    tuner.execute(exec_config)
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    app_name = app_data['app']
    pipe_name = app_data['app']

    out_pyramid = pyramid_blending(pipe_data)
    live_outs = [out_pyramid]

    R = pipe_data['R']
    C = pipe_data['C']

    rows = app_data['rows'] - 2
    cols = app_data['cols'] - 2

    param_estimates = [(R, rows), (C, cols)]
    param_constraints = [ Condition(R, "==", rows), \
                          Condition(C, "==", cols) ]

    dst_path = "/tmp"

    group_size_configs = [3, 5, 7, 9, 10]

    tile_size_configs = []

    tile_size_configs.append([64, 256])
    tile_size_configs.append([64, 128])

    tile_size_configs.append([32, 512])
    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 64])

    tile_size_configs.append([16, 512])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 64])

    tile_size_configs.append([8, 512])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 64])
    tile_size_configs.append([8, 32])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {
        "_tuner_app_name": app_name,
        "_tuner_live_outs": live_outs,
        "_tuner_param_constraints": param_constraints,  #optional
        "_tuner_param_estimates": param_estimates,  #optional
        "_tuner_tile_size_configs": tile_size_configs,  #optional
        "_tuner_group_size_configs": group_size_configs,  #optional
        "_tuner_opts": opts,  #optional
        "_tuner_dst_path": dst_path,  # optional
        "_tuner_cxx_string": cxx_string,  # optional
        "_tuner_root_path": ROOT,  # needed if pool_alloc is set
        "_tuner_debug_flag": True,  # optional
        "_tuner_opt_datadict": app_data
    }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)

    img_data = app_data['img_data']
    IN1 = img_data['IN1']
    IN2 = img_data['IN2']
    OUT = img_data['OUT']
    mask = img_data['mask_ghost']

    pipe_args = {}
    pipe_args['R'] = rows
    pipe_args['C'] = cols
    pipe_args['img1'] = IN1
    pipe_args['img2'] = IN2
    pipe_args['mask'] = mask
    pipe_args['blend'] = OUT

    # Execute the generated variants
    # ==============================

    exec_config = {
        "_tuner_app_name": app_name,
        "_tuner_pipe": _tuner_pipe,
        "_tuner_pipe_arg_data": pipe_args,
        "_tuner_src_path": _tuner_src_path,  # optional
        "_tuner_configs_count": _tuner_configs_count,  # optional
        "_tuner_omp_threads": 4,  # optional
        "_tuner_nruns": 1,  # optional
        "_tuner_debug_flag": True,  # optional
        #"_tuner_custom_executor": minimal_exec_mg,
        "_tuner_app_data": app_data
    }

    tuner.execute(exec_config)
Beispiel #8
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    app_name = app_data['app']
    pipe_name = app_data['app']

    out_campipe = camera_pipe(pipe_data)
    live_outs = [out_campipe]
    
    R = pipe_data['R']
    C = pipe_data['C']

    rows = app_data['rows']
    cols = app_data['cols']

    param_estimates = [(R, rows), (C, cols)]
    param_constraints = [ Condition(R, "==", rows), \
                          Condition(C, "==", cols) ]
    
    dst_path = "/tmp"

    group_size_configs = [4, 8, 12, 16, 100]

    tile_size_configs = []

    tile_size_configs.append([64, 256])
    tile_size_configs.append([64, 128])

    tile_size_configs.append([32, 512])

    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 64])

    tile_size_configs.append([16, 512])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 64])

    tile_size_configs.append([8, 512])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 64])
    tile_size_configs.append([8, 32])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {"_tuner_app_name": app_name,
                  "_tuner_pipe_name": pipe_name, # optional
                  "_tuner_live_outs": live_outs,
                  "_tuner_param_constraints": param_constraints, #optional
                  "_tuner_param_estimates": param_estimates, #optional
                  "_tuner_tile_size_configs": tile_size_configs, #optional
                  "_tuner_group_size_configs": group_size_configs, #optional
                  "_tuner_opts": opts, #optional
                  "_tuner_dst_path" : dst_path, # optional
                  "_tuner_cxx_string" : cxx_string, # optional
                  "_tuner_root_path" : ROOT, # needed if pool_alloc is set
                  "_tuner_debug_flag": True, # optional
                  "_tuner_opt_datadict": app_data
                 }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)

    '''
    _tuner_src_path = '/tmp/PolyEzSz1jRLRPMage/'
    _tuner_configs_count = 75
    _tuner_pipe = buildPipeline(live_outs)
    '''

    img_data = app_data['img_data']
    IN = img_data['IN']
    OUT = img_data['OUT']
    M3200 = img_data['M3200']
    M7000 = img_data['M7000']

    app_args = app_data['app_args']
    colour_temp = float(app_args.colour_temp)
    contrast = float(app_args.contrast)
    gamma = float(app_args.gamma)

    pipe_args = {}
    pipe_args['R'] = rows
    pipe_args['C'] = cols
    pipe_args['colour_temp'] = colour_temp
    pipe_args['contrast'] = contrast
    pipe_args['gamma'] = gamma
    pipe_args['matrix_3200'] = M3200
    pipe_args['matrix_7000'] = M7000
    pipe_args['img'] = IN 
    pipe_args['process'] = OUT 

    # Execute the generated variants
    # ==============================

    exec_config = {"_tuner_app_name": app_name,
                   "_tuner_pipe_name": pipe_name, # optional
                   "_tuner_pipe": _tuner_pipe,
                   "_tuner_pipe_arg_data": pipe_args,
                   "_tuner_src_path": _tuner_src_path, # optional
                   "_tuner_configs_count": _tuner_configs_count, # optional
                   "_tuner_omp_threads": 4, # optional
                   "_tuner_nruns": 1, # optional
                   "_tuner_debug_flag": True, # optional
                   #"_tuner_custom_executor": minimal_exec_mg,
                   "_tuner_app_data": app_data
                  }

    tuner.execute(exec_config)
Beispiel #9
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    app_name = app_data['app_name']
    pipe_name = app_data['app']
    pipe_func_name = "pipeline_"+pipe_name

    out_unsharp = unsharp_mask(pipe_data)
    live_outs = [out_unsharp]
    
    R = pipe_data['R']
    C = pipe_data['C']

    rows = app_data['rows']-2
    cols = app_data['cols']-2
    threshold = app_data['threshold']
    weight = app_data['weight']

    param_estimates = [(R, rows), (C, cols)]
    param_constraints = [ Condition(R, "==", rows), \
                          Condition(C, "==", cols) ]
    
    dst_path = "/tmp"

    group_size_configs = [3, 5, 7, 9, 10]
    #group_size_configs = [10]


    tile_size_configs = []
    
    tile_size_configs.append([64, 256])
    tile_size_configs.append([64, 128])
    
    tile_size_configs.append([32, 512])
    tile_size_configs.append([32, 256])
    tile_size_configs.append([32, 128])
    tile_size_configs.append([32, 64])

    tile_size_configs.append([16, 512])
    tile_size_configs.append([16, 256])
    tile_size_configs.append([16, 128])
    tile_size_configs.append([16, 64])

    tile_size_configs.append([8, 512])
    tile_size_configs.append([8, 256])
    tile_size_configs.append([8, 128])
    tile_size_configs.append([8, 64])
    tile_size_configs.append([8, 32])
   
    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {"_tuner_app_name": app_name,
                  "_tuner_live_outs": live_outs,
                  "_tuner_param_constraints": param_constraints, #optional
                  "_tuner_param_estimates": param_estimates, #optional
                  "_tuner_tile_size_configs": tile_size_configs, #optional
                  "_tuner_group_size_configs": group_size_configs, #optional
                  "_tuner_opts": opts, #optional
                  "_tuner_dst_path" : dst_path, # optional
                  "_tuner_cxx_string" : cxx_string, # optional
                  "_tuner_root_path" : ROOT, # needed if pool_alloc is set
                  "_tuner_debug_flag": True, # optional
                  "_tuner_opt_datadict": app_data
                 }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)

    '''
    _tuner_src_path = '/tmp/PolycNUUEYoLt2Mage'
    _tuner_configs_count = 75
    _tuner_pipe = buildPipeline(live_outs)
    '''

    img_data = app_data['img_data']
    IN = img_data['IN']
    OUT = img_data['OUT']

    pipe_args = {}
    pipe_args['R'] = rows
    pipe_args['C'] = cols
    pipe_args['threshold'] = threshold
    pipe_args['weight'] = weight
    pipe_args['img'] = IN 
    pipe_args['mask'] = OUT 


    # Execute the generated variants
    # ==============================

    exec_config = {"_tuner_app_name": app_name,
                   "_tuner_pipe": _tuner_pipe,
                   "_tuner_pipe_arg_data": pipe_args,
                   "_tuner_src_path": _tuner_src_path, # optional
                   "_tuner_configs_count": _tuner_configs_count, # optional
                   "_tuner_omp_threads": 4, # optional
                   "_tuner_nruns": 1, # optional
                   "_tuner_debug_flag": True, # optional
                   #"_tuner_custom_executor": minimal_exec_mg,
                   "_tuner_app_data": app_data
                  }

    tuner.execute(exec_config)
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']

    app_name = app_data['app_name']
    pipe_name = app_data['app']
    pipe_func_name = "pipeline_" + pipe_name

    out_mfd, inline_func = minifluxdiv(pipe_data)
    live_outs = [out_mfd]

    B = pipe_data['B']
    N = pipe_data['N']

    boxes = app_data['boxes']
    cells = app_data['cells']

    param_estimates = [(B, boxes), (N, cells)]
    param_constraints = [ Condition(B, "==", boxes), \
                          Condition(N, "==", cells) ]

    dst_path = "/tmp"

    #group_size_configs = [3, 5, 7, 9, 10]
    group_size_configs = [4]
    #group_size_configs = [1]

    tile_size_configs = []
    tile_size_configs.append([7, 7, 128])

    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']
    if app_data['dpfuse']:
        opts += ['dpfuse']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {
        "_tuner_app_name": app_name,
        "_tuner_live_outs": live_outs,
        "_tuner_param_constraints": param_constraints,  #optional
        "_tuner_param_estimates": param_estimates,  #optional
        "_tuner_tile_size_configs": tile_size_configs,  #optional
        "_tuner_group_size_configs": group_size_configs,  #optional
        "_tuner_opts": opts,  #optional
        "_tuner_dst_path": dst_path,  # optional
        "_tuner_cxx_string": cxx_string,  # optional
        "_tuner_root_path": ROOT,  # needed if pool_alloc is set
        "_tuner_debug_flag": True,  # optional
        "_tuner_opt_datadict": app_data
    }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)

    # '''
    # _tuner_src_path = '/tmp/PolycNUUEYoLt2Mage'
    # _tuner_configs_count = 75
    # _tuner_pipe = buildPipeline(live_outs)
    # '''

    mfd_data = app_data['mfd_data']
    IN = mfd_data['IN']
    OUT = mfd_data['OUT']

    pipe_args = {}
    pipe_args['B'] = boxes
    pipe_args['N'] = cells
    pipe_args['box'] = IN
    pipe_args['sums'] = OUT

    # Execute the generated variants
    # ==============================

    exec_config = {
        "_tuner_app_name": app_name,
        "_tuner_pipe": _tuner_pipe,
        "_tuner_pipe_arg_data": pipe_args,
        "_tuner_src_path": _tuner_src_path,  # optional
        "_tuner_configs_count": _tuner_configs_count,  # optional
        "_tuner_omp_threads": 4,  # optional
        "_tuner_nruns": 10,  # optional
        "_tuner_debug_flag": True,  # optional
        #"_tuner_custom_executor": minimal_exec_mg,
        "_tuner_app_data": app_data
    }

    tuner.execute(exec_config)
Beispiel #11
0
def auto_tune(app_data):
    pipe_data = app_data['pipe_data']
    app_name = app_data['app']

    stencil = stencil_jacobi(app_data)

    live_outs = [stencil]
    N = pipe_data['N']
    param_estimates = [(N, app_data['N'])]
    param_constraints = [ Condition(N, '==', app_data['N']) ]
    dst_path = "/tmp"

    group_size_configs = [2, 3, 4]

    tile_size_configs = []

    tile_size_configs.append([8, 8, 32])
    tile_size_configs.append([8, 8, 64])
    tile_size_configs.append([8, 8, 128])
    tile_size_configs.append([8, 16, 16])
    tile_size_configs.append([8, 16, 32])
    tile_size_configs.append([8, 16, 64])
    tile_size_configs.append([8, 32, 32])
    tile_size_configs.append([8, 32, 64])
    tile_size_configs.append([8, 64, 64])
    tile_size_configs.append([16, 16, 16])
    tile_size_configs.append([16, 16, 32])
    tile_size_configs.append([16, 16, 64])
    tile_size_configs.append([16, 32, 32])
    tile_size_configs.append([16, 32, 64])
    tile_size_configs.append([32, 32, 32])

    opts = []
    # relative path to root directory from app dir
    ROOT = app_data['ROOT']
    opts = []
    if app_data['early_free']:
        opts += ['early_free']
    if app_data['optimize_storage']:
        opts += ['optimize_storage']
    if app_data['pool_alloc']:
        opts += ['pool_alloc']
    if app_data['multipar']:
        opts += ['multipar']

    gen_compile_string(app_data)
    cxx_string = app_data['cxx_string']

    # Generate Variants for Tuning
    # ============================

    gen_config = {"_tuner_app_name": app_name,
                  "_tuner_live_outs": live_outs,
                  "_tuner_param_constraints": param_constraints, #optional
                  "_tuner_param_estimates": param_estimates, #optional
                  "_tuner_tile_size_configs": tile_size_configs, #optional
                  "_tuner_group_size_configs": group_size_configs, #optional
                  "_tuner_opts": opts, #optional
                  "_tuner_dst_path" : dst_path, # optional
                  "_tuner_cxx_string" : cxx_string, # optional
                  "_tuner_root_path" : ROOT, # needed if pool_alloc is set
                  "_tuner_debug_flag": True, # optional
                  "_tuner_opt_datadict": app_data
                 }

    _tuner_src_path, _tuner_configs_count, _tuner_pipe = \
        tuner.generate(gen_config)

    # Execute the generated variants
    # ==============================

    exec_config = {"_tuner_app_name": app_name,
                   "_tuner_pipe": _tuner_pipe,
                   "_tuner_src_path": _tuner_src_path, # optional
                   "_tuner_configs_count": _tuner_configs_count, # optional
                   "_tuner_omp_threads": 4, # optional
                   "_tuner_nruns": 1, # optional
                   "_tuner_debug_flag": True, # optional
                   "_tuner_custom_executor": custom_exec_jacobi,
                   "_tuner_app_data": app_data
                  }

    tuner.execute(exec_config)