Reference Guide
2.5.0
|
Public Member Functions | |
def | __init__ (self) |
def | __str__ (self) |
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) |
Static Public Attributes | |
tuple | excluded_node_types = (PSyDataNode,) |
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 OpenACC loop directive to a loop. This directive must be within the scope of some OpenACC Parallel region (at code-generation time). For example: >>> from psyclone.parse.algorithm import parse >>> from psyclone.parse.utils import ParseError >>> from psyclone.psyGen import PSyFactory >>> from psyclone.errors import GenerationError >>> api = "gocean1.0" >>> ast, invokeInfo = parse(GOCEAN_SOURCE_FILE, api=api) >>> psy = PSyFactory(api).create(invokeInfo) >>> >>> from psyclone.psyGen import TransInfo >>> t = TransInfo() >>> ltrans = t.get_trans_name('ACCLoopTrans') >>> rtrans = t.get_trans_name('ACCParallelTrans') >>> >>> schedule = psy.invokes.get('invoke_0').schedule >>> # Uncomment the following line to see a text view of the schedule >>> # print(schedule.view()) >>> >>> # Apply the OpenACC Loop transformation to *every* loop in the schedule >>> for child in schedule.children[:]: ... ltrans.apply(child) >>> >>> # Enclose all of these loops within a single OpenACC parallel region >>> rtrans.apply(schedule) >>>
Definition at line 567 of file transformations.py.
def psyclone.transformations.ACCLoopTrans.apply | ( | self, | |
node, | |||
options = None |
|||
) |
Apply the ACCLoop transformation to the specified node. This node must be a Loop since this transformation corresponds to inserting a directive immediately before a loop, e.g.: .. code-block:: fortran !$ACC LOOP do ... ... end do At code-generation time (when :py:meth:`psyclone.psyir.nodes.ACCLoopDirective.gen_code` is called), this node must be within (i.e. a child of) a PARALLEL region. :param node: the supplied node to which we will apply the Loop transformation. :type node: :py:class:`psyclone.psyir.nodes.Loop` :param options: a dictionary with options for transformations. :type options: Optional[Dict[str, Any]] :param int options["collapse"]: number of nested loops to collapse. :param bool options["independent"]: whether to add the "independent" clause to the directive (not strictly necessary within PARALLEL regions). :param bool options["sequential"]: whether to add the "seq" clause to the directive. :param bool options["gang"]: whether to add the "gang" clause to the directive. :param bool options["vector"]: whether to add the "vector" clause to the directive.
Reimplemented from psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.
Definition at line 634 of file transformations.py.
References psyclone.psyir.nodes.acc_directives.ACCLoopDirective._gang, psyclone.transformations.ACCLoopTrans._gang, psyclone.psyir.nodes.acc_directives.ACCLoopDirective._independent, psyclone.transformations.ACCLoopTrans._independent, psyclone.psyir.nodes.acc_directives.ACCLoopDirective._sequential, psyclone.transformations.ACCLoopTrans._sequential, psyclone.psyir.nodes.acc_directives.ACCLoopDirective._vector, and psyclone.transformations.ACCLoopTrans._vector.