Reference Guide
2.5.0
|
Public Member Functions | |
def | __init__ (self, grainsize=None, num_tasks=None, nogroup=False) |
def | __str__ (self) |
def | omp_nogroup (self) |
def | omp_nogroup (self, nogroup) |
def | omp_grainsize (self) |
def | omp_grainsize (self, value) |
def | omp_num_tasks (self) |
def | omp_num_tasks (self, value) |
def | apply (self, node, options=None) |
Public Member Functions inherited from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans | |
def | validate (self, node, options=None) |
Public Member Functions inherited from psyclone.psyir.transformations.loop_trans.LoopTrans | |
def | name (self) |
Public Attributes | |
omp_grainsize | |
omp_num_tasks | |
omp_nogroup | |
Additional Inherited Members | |
Static Public Attributes inherited from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans | |
tuple | excluded_node_types = (nodes.Return, psyGen.HaloExchange, nodes.CodeBlock) |
Static Public Attributes inherited from psyclone.psyir.transformations.loop_trans.LoopTrans | |
tuple | excluded_node_types = () |
Adds an OpenMP taskloop directive to a loop. Only one of grainsize or num_tasks must be specified. TODO: #1364 Taskloops do not yet support reduction clauses. :param grainsize: the grainsize to use in for this transformation. :type grainsize: int or None :param num_tasks: the num_tasks to use for this transformation. :type num_tasks: int or None :param bool nogroup: whether or not to use a nogroup clause for this transformation. Default is False. For example: >>> from pysclone.parse.algorithm import parse >>> from psyclone.psyGen import PSyFactory >>> api = "gocean1.0" >>> ast, invokeInfo = parse(GOCEAN_SOURCE_FILE, api=api) >>> psy = PSyFactory(api).create(invokeInfo) >>> >>> from psyclone.transformations import OMPParallelTrans, OMPSingleTrans >>> from psyclone.transformations import OMPTaskloopTrans >>> from psyclone.psyir.transformations import OMPTaskwaitTrans >>> singletrans = OMPSingleTrans() >>> paralleltrans = OMPParallelTrans() >>> tasklooptrans = OMPTaskloopTrans() >>> taskwaittrans = OMPTaskwaitTrans() >>> >>> schedule = psy.invokes.get('invoke_0').schedule >>> # Uncomment the following line to see a text view of the schedule >>> # print(schedule.view()) >>> >>> # Apply the OpenMP Taskloop transformation to *every* loop >>> # in the schedule. >>> # This ignores loop dependencies. These can be handled >>> # by the OMPTaskwaitTrans >>> for child in schedule.children: >>> tasklooptrans.apply(child) >>> # Enclose all of these loops within a single OpenMP >>> # SINGLE region >>> singletrans.apply(schedule.children) >>> # Enclose all of these loops within a single OpenMP >>> # PARALLEL region >>> paralleltrans.apply(schedule.children) >>> # Ensure loop dependencies are satisfied >>> taskwaittrans.apply(schedule.children) >>> # Uncomment the following line to see a text view of the schedule >>> # print(schedule.view())
Definition at line 109 of file transformations.py.
def psyclone.transformations.OMPTaskloopTrans.apply | ( | self, | |
node, | |||
options = None |
|||
) |
Apply the OMPTaskloopTrans transformation to the specified node in a Schedule. This node must be a Loop since this transformation corresponds to wrapping the generated code with directives like so: .. code-block:: fortran !$OMP TASKLOOP do ... ... end do !$OMP END TASKLOOP At code-generation time (when :py:meth:`OMPTaskloopDirective.gen_code` is called), this node must be within (i.e. a child of) an OpenMP SERIAL region. If the keyword "nogroup" is specified in the options, it will cause a nogroup clause be generated if it is set to True. This will override the value supplied to the constructor, but will only apply to the apply call to which the value is supplied. :param node: the supplied node to which we will apply the \ OMPTaskloopTrans transformation :type node: :py:class:`psyclone.psyir.nodes.Node` :param options: a dictionary with options for transformations\ and validation. :type options: Optional[Dict[str, Any]] :param bool options["nogroup"]: indicating whether a nogroup clause should be applied to this taskloop.
Reimplemented from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.
Definition at line 309 of file transformations.py.
References psyclone.transformations.OMPTaskloopTrans.omp_nogroup.
def psyclone.transformations.OMPTaskloopTrans.omp_grainsize | ( | self | ) |
Returns the grainsize that will be specified by this transformation. By default the grainsize clause is not applied, so grainsize is None. :returns: The grainsize specified by this transformation. :rtype: int or None
Definition at line 201 of file transformations.py.
References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._grainsize, and psyclone.transformations.OMPTaskloopTrans._grainsize.
def psyclone.transformations.OMPTaskloopTrans.omp_grainsize | ( | self, | |
value | |||
) |
Sets the grainsize that will be specified by this transformation. Checks the grainsize is a positive integer value or None. :param value: integer value to use in the grainsize clause. :type value: int or None :raises TransformationError: if value is not an int and is not None. :raises TransformationError: if value is negative. :raises TransformationError: if grainsize and num_tasks are \ both specified.
Definition at line 213 of file transformations.py.
References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._grainsize, psyclone.transformations.OMPTaskloopTrans._grainsize, and psyclone.transformations.OMPTaskloopTrans.omp_num_tasks.
def psyclone.transformations.OMPTaskloopTrans.omp_nogroup | ( | self | ) |
Returns whether the nogroup clause should be specified for this transformation. By default the nogroup clause is applied. :returns: whether the nogroup clause should be specified by this transformation. :rtype: bool
Definition at line 173 of file transformations.py.
References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._nogroup, and psyclone.transformations.OMPTaskloopTrans._nogroup.
def psyclone.transformations.OMPTaskloopTrans.omp_nogroup | ( | self, | |
nogroup | |||
) |
Sets whether the nogroup clause should be specified for this transformation. :param bool nogroup: value to set whether the nogroup clause should be used for this transformation. raises TypeError: if the nogroup parameter is not a bool.
Definition at line 185 of file transformations.py.
References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._nogroup, and psyclone.transformations.OMPTaskloopTrans._nogroup.
def psyclone.transformations.OMPTaskloopTrans.omp_num_tasks | ( | self | ) |
Returns the num_tasks that will be specified by this transformation. By default the num_tasks clause is not applied so num_tasks is None. :returns: The grainsize specified by this transformation. :rtype: int or None
Definition at line 242 of file transformations.py.
References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._num_tasks, and psyclone.transformations.OMPTaskloopTrans._num_tasks.
def psyclone.transformations.OMPTaskloopTrans.omp_num_tasks | ( | self, | |
value | |||
) |
Sets the num_tasks that will be specified by this transformation. Checks that num_tasks is a positive integer value or None. :param value: integer value to use in the num_tasks clause. :type value: int or None :raises TransformationError: if value is not an int and is not None. :raises TransformationError: if value is negative. :raises TransformationError: if grainsize and num_tasks are \ both specified.
Definition at line 254 of file transformations.py.
References psyclone.psyir.nodes.omp_directives.OMPTaskloopDirective._num_tasks, psyclone.transformations.OMPTaskloopTrans._num_tasks, psyclone.transformations.OMPTaskloopTrans.omp_grainsize, psyclone.transformations.OMPTaskloopTrans.omp_nogroup, and psyclone.transformations.OMPTaskloopTrans.omp_num_tasks.