Reference Guide
2.5.0
|
Public Member Functions | |
def | __str__ (self) |
def | apply (self, node, options=None) |
Public Member Functions inherited from psyclone.psyir.transformations.loop_trans.LoopTrans | |
def | validate (self, node, options=None) |
def | name (self) |
Additional Inherited Members | |
Static Public Attributes inherited from psyclone.psyir.transformations.loop_trans.LoopTrans | |
tuple | excluded_node_types = () |
Split a Dynamo 0.3 loop over cells into colours so that it can be parallelised. For example: >>> from psyclone.parse.algorithm import parse >>> from psyclone.psyGen import PSyFactory >>> import transformations >>> import os >>> import pytest >>> >>> TEST_API = "dynamo0.3" >>> _,info=parse(os.path.join(os.path.dirname(os.path.abspath(__file__)), >>> "tests", "test_files", "dynamo0p3", >>> "4.6_multikernel_invokes.f90"), >>> api=TEST_API) >>> psy = PSyFactory(TEST_API).create(info) >>> invoke = psy.invokes.get('invoke_0') >>> schedule = invoke.schedule >>> >>> ctrans = Dynamo0p3ColourTrans() >>> otrans = DynamoOMPParallelLoopTrans() >>> >>> # Colour all of the loops >>> for child in schedule.children: >>> ctrans.apply(child) >>> >>> # Then apply OpenMP to each of the colour loops >>> for child in schedule.children: >>> otrans.apply(child.children[0]) >>> >>> # Uncomment the following line to see a text view of the schedule >>> # print(schedule.view()) Colouring in the LFRic (Dynamo 0.3) API is subject to the following rules: * Only kernels which operate on 'CELL_COLUMN's and which increment a field on a continuous function space require colouring. Kernels that update a field on a discontinuous function space will cause this transformation to raise an exception. Kernels that only write to a field on a continuous function space also do not require colouring but are permitted. * A kernel may have at most one field with 'GH_INC' access. * A separate colour map will be required for each field that is coloured (if an invoke contains >1 kernel call).
Definition at line 1040 of file transformations.py.
def psyclone.transformations.Dynamo0p3ColourTrans.apply | ( | self, | |
node, | |||
options = None |
|||
) |
Performs Dynamo0.3-specific error checking and then uses the parent class to convert the Loop represented by :py:obj:`node` into a nested loop where the outer loop is over colours and the inner loop is over cells of that colour. :param node: the loop to transform. :type node: :py:class:`psyclone.domain.lfric.LFRicLoop` :param options: a dictionary with options for transformations.\ :type options: Optional[Dict[str, Any]]
Reimplemented from psyclone.transformations.ColourTrans.
Definition at line 1090 of file transformations.py.
References psyclone.psyir.transformations.loop_trans.LoopTrans.validate().