dace.optimization package

Tuning APIs

class dace.optimization.auto_tuner.AutoTuner(sdfg)

Bases: object

General API for automatic SDFG tuners. Contains a single method: optimize, which initiates the tuning process.

optimize(apply=True, measurements=30)

Tunes an SDFG.

Parameters:
  • apply (bool) – Applies the best-found configuration on the original SDFG.

  • measurements (int) – The number of times to run the SDFG for performance analysis.

Return type:

Dict[Any, Any]

Returns:

A dictionary mapping measured configurations to results (usually string to numeric runtimes).

class dace.optimization.cutout_tuner.CutoutTuner(task, sdfg)

Bases: AutoTuner

An auto-tuner that cuts out subgraphs of the original SDFG to tune separately. In order to tune an SDFG, a “dry run” must first be called to collect data from intermediate access nodes (in order to ensure correctness of the tuned subgraph). Subsequently, sub-classes of this cutout tuning interface will select subgraphs to test transformations on.

For example:

tuner = DataLayoutTuner(sdfg)

# Create instrumented data report
tuner.dry_run(sdfg, arg1, arg2, arg3=4)

results = tuner.optimize()
# results will now contain the fastest data layout configurations for each array
apply(config, cutout, **kwargs)
Return type:

None

config_from_key(key, cutout, **kwargs)
Return type:

Any

cutouts()
Return type:

Generator[Tuple[SDFGState, str], None, None]

static dry_run(sdfg, *args, **kwargs)
Return type:

Any

evaluate(**kwargs)
Return type:

float

file_name(label)
Return type:

str

measure(cutout, dreport, repetitions=30, timeout=300.0)
Return type:

float

optimize(measurements=30, apply=False, **kwargs)

Tunes an SDFG.

Parameters:
  • apply (bool) – Applies the best-found configuration on the original SDFG.

  • measurements (int) – The number of times to run the SDFG for performance analysis.

Return type:

Dict[Any, Any]

Returns:

A dictionary mapping measured configurations to results (usually string to numeric runtimes).

pre_evaluate(**kwargs)
Return type:

Dict

search(cutout, measurements, **kwargs)
Return type:

Dict[str, float]

space(**kwargs)
Return type:

Generator[Any, None, None]

property task: str
static top_k_configs(tuning_report, k)
Return type:

List[Tuple[str, float]]

try_load(file_name)
Return type:

Dict

dace.optimization.cutout_tuner.tqdm(x, **kwargs)
class dace.optimization.distributed_cutout_tuner.DistributedCutoutTuner(tuner)

Bases: object

Distributed wrapper for cutout tuning that distributes the cutouts across ranks.

optimize(measurements=30, **kwargs)
Return type:

Dict

class dace.optimization.distributed_cutout_tuner.DistributedSpaceTuner(tuner)

Bases: object

Distributed wrapper for cutout tuning that distributes search space of each cutout across ranks.

optimize(measurements=30, **kwargs)
Return type:

Dict

dace.optimization.distributed_cutout_tuner.tqdm(x, **kwargs)

Auto-Tuners

class dace.optimization.data_layout_tuner.DataLayoutTuner(sdfg, measurement=<InstrumentationType.Timer: 2>)

Bases: CutoutTuner

apply(config, label, **kwargs)
Return type:

None

config_from_key(key, **kwargs)
Return type:

List[int]

cutouts()
Return type:

Generator[Tuple[SDFG, str], None, None]

evaluate(config, cutout, arguments, measurements, **kwargs)
Return type:

float

pre_evaluate(cutout, dreport, measurements, group_by, **kwargs)
Return type:

Dict

setup_tuning_groups(cutout, group_by)
Return type:

Optional[List[Set[str]]]

space(cutout, groups=None)
Return type:

Generator[Set[str], None, None]

class dace.optimization.data_layout_tuner.TuningGroups(value)

Bases: Enum

An enumeration.

Dimension = 3
Inputs_Outputs = 2
Inputs_Outputs_Dimension = 4
Separate = 1
dace.optimization.data_layout_tuner.tqdm(x, **kwargs)
class dace.optimization.map_permutation_tuner.MapPermutationTuner(sdfg, measurement=<InstrumentationType.Timer: 2>)

Bases: CutoutTuner

apply(config, label, **kwargs)
Return type:

None

config_from_key(key, **kwargs)
Return type:

List[str]

cutouts()
Return type:

Generator[Tuple[SDFGState, str], None, None]

evaluate(config, cutout, map_entry_id, measurements, **kwargs)
Return type:

float

pre_evaluate(cutout, measurements, **kwargs)
Return type:

Dict

space(map_entry, **kwargs)
Return type:

Generator[Tuple[str], None, None]

dace.optimization.map_permutation_tuner.tqdm(x, **kwargs)
class dace.optimization.map_tiling_tuner.MapTilingTuner(sdfg, measurement=<InstrumentationType.Timer: 2>)

Bases: CutoutTuner

apply(config, label, **kwargs)
Return type:

None

config_from_key(key, **kwargs)
Return type:

List[int]

cutouts()
Return type:

Generator[Tuple[SDFG, str], None, None]

evaluate(config, cutout, map_entry_id, measurements, **kwargs)
Return type:

float

pre_evaluate(cutout, measurements, **kwargs)
Return type:

Dict

space(map_entry)
Return type:

Generator[Tuple[int], None, None]

dace.optimization.map_tiling_tuner.tqdm(x, **kwargs)
class dace.optimization.on_the_fly_map_fusion_tuner.OnTheFlyMapFusionTuner(sdfg, i, j, measurement=<InstrumentationType.Timer: 2>)

Bases: CutoutTuner

apply(config, label, **kwargs)
Return type:

None

config_from_key(key, cutout, **kwargs)
Return type:

Tuple[int, List[int]]

cutouts()
evaluate(config, cutout, measurements, **kwargs)
Return type:

float

static map_descriptor(state, map_entry)
Return type:

str

pre_evaluate(cutout, measurements, **kwargs)
Return type:

Dict

space(cutout)
Return type:

Generator[List[bool], None, None]

static transfer(sdfg, tuner, k=5)
dace.optimization.on_the_fly_map_fusion_tuner.tqdm(x, **kwargs)
class dace.optimization.subgraph_fusion_tuner.SubgraphFusionTuner(sdfg, i, j, measurement=<InstrumentationType.Timer: 2>)

Bases: CutoutTuner

apply(config, label, **kwargs)
Return type:

None

config_from_key(key, cutout, **kwargs)
Return type:

Tuple[int, List[int]]

cutouts(sdfg=None)
evaluate(config, cutout, measurements, **kwargs)
Return type:

float

static map_descriptor(state, map_entry)
Return type:

str

pre_evaluate(cutout, measurements, **kwargs)
Return type:

Dict

space(cutout)
Return type:

Generator[List[bool], None, None]

static transfer(sdfg, tuner, k=5)
dace.optimization.subgraph_fusion_tuner.tqdm(x, **kwargs)

Utilities

class dace.optimization.utils.MeasureProcess(*args, **kwargs)

Bases: Process

property exception
run()

Method to be run in sub-process; can be overridden in sub-class

dace.optimization.utils.get_world_rank()
dace.optimization.utils.get_world_size()
dace.optimization.utils.measure(sdfg, dreport=None, repetitions=30, print_report=False)
dace.optimization.utils.partition(it, size)
dace.optimization.utils.subprocess_measure(cutout, dreport, repetitions=30, timeout=600.0)
Return type:

float

Module contents