dace.frontend package

Submodules

dace.frontend.operations module

dace.frontend.operations.detect_reduction_type(wcr_str, openmp=False)

Inspects a lambda function and tries to determine if it’s one of the built-in reductions that frameworks such as MPI can provide.

Parameters:
  • wcr_str – A Python string representation of the lambda function.
  • openmp – Detect additional OpenMP reduction types.
Returns:

dtypes.ReductionType if detected, dtypes.ReductionType.Custom if not detected, or None if no reduction is found.

dace.frontend.operations.elementwise(func, in_array, out_array=None)

Applies a function to each element of the array :param in_array: array to apply to. :param out_array: output array to write the result to. If None, a new array will be returned :param func: lambda function to apply to each element. :return: new array with the lambda applied to each element

dace.frontend.operations.is_op_associative(wcr_str)

Inspects a custom lambda function and tries to determine whether it is symbolically associative (disregarding data type). :param wcr_str: A string in Python representing a lambda function. :return: True if associative, False if not, None if cannot be

determined.
dace.frontend.operations.is_op_commutative(wcr_str)

Inspects a custom lambda function and tries to determine whether it is symbolically commutative (disregarding data type). :param wcr_str: A string in Python representing a lambda function. :return: True if commutative, False if not, None if cannot be

determined.
dace.frontend.operations.reduce(op, in_array, out_array=None, axis=None, identity=None)

Reduces an array according to a binary operation op, starting with initial value identity, over the given axis (or axes if axis is a list), to out_array.

Requires out_array with len(axis) dimensions less than in_array, or a scalar if axis is None.

Parameters:
  • op – binary operation to use for reduction.
  • in_array – array to reduce.
  • out_array – output array to write the result to. If None, a new array will be returned.
  • axis – the axis or axes to reduce over. If None, all axes will be reduced.
  • identity – intial value for the reduction. If None, uses value stored in output.
Returns:

None if out_array is given, or the newly created out_array if out_array is None.

dace.frontend.operations.timethis(sdfg, title, flop_count, f, *args, **kwargs)

Runs a function multiple (DACE_treps) times, logs the running times to a file, and prints the median time (with FLOPs if given). :param sdfg: The SDFG belonging to the measurement. :param title: A title of the measurement. :param flop_count: Number of floating point operations in program.

If greater than zero, produces a median FLOPS report.
Parameters:
  • f – The function to measure.
  • args – Arguments to invoke the function with.
  • kwargs – Keyword arguments to invoke the function with.
Returns:

Latest return value of the function.

Module contents