def build_mg_cycle(app_data):
    pipe_data = app_data['pipe_data']
    cycle_type = app_data['cycle']

    if cycle_type == 'V':
        # construct the multigrid v-cycle pipeline
        mg = v_cycle(app_data)
    elif cycle_type == 'W':
        # construct the multigrid w-cycle pipeline
        mg = w_cycle(app_data)

    n = pipe_data['n']

    live_outs = [mg]
    pipe_name = app_data['cycle_name']
    p_estimates = [(n, app_data['n'])]
    p_constraints = [ Condition(n, "==", app_data['n']) ]
    t_size = [8, 8, 32]
    if app_data['naive']:
        g_size = 1
    else:
        g_size = 6
    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']

    mg_pipe = buildPipeline(live_outs,
                            param_estimates=p_estimates,
                            param_constraints=p_constraints,
                            tile_sizes = t_size,
                            group_size = g_size,
                            options = opts,
                            pipe_name = pipe_name)

    return mg_pipe
Beispiel #2
0
def build_mg_cycle(app_data):
    pipe_data = app_data['pipe_data']
    cycle_type = app_data['cycle']

    if cycle_type == 'V':
        # construct the multigrid v-cycle pipeline
        mg = v_cycle(app_data)
    elif cycle_type == 'W':
        # construct the multigrid w-cycle pipeline
        mg = w_cycle(app_data)

    n = pipe_data['n']

    live_outs = [mg]
    pipe_name = app_data['cycle_name']
    p_estimates = [(n, app_data['n'])]
    p_constraints = [ Condition(n, "==", app_data['n']) ]
    t_size = [32, 512]
    g_size = 10
    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']

    mg_pipe = buildPipeline(live_outs,
                            param_estimates=p_estimates,
                            param_constraints=p_constraints,
                            tile_sizes = t_size,
                            group_size = g_size,
                            options = opts,
                            pipe_name = pipe_name)

    return mg_pipe
Beispiel #3
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 #4
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)