Reference Guide
2.5.0
|
Public Member Functions | |
def | __init__ (self, parent, call, name, ArgumentsClass, check=True) |
def | args (self) |
def | node_str (self, colour=True) |
def | reference_accesses (self, var_accesses) |
def | is_reduction (self) |
def | reduction_arg (self) |
def | reprod_reduction (self) |
def | local_reduction_name (self) |
def | zero_reduction_variable (self, parent, position=None) |
def | reduction_sum_loop (self, parent) |
def | arg_descriptors (self) |
def | arg_descriptors (self, obj) |
def | arguments (self) |
def | name (self) |
def | name (self, value) |
def | is_coloured (self) |
def | iterates_over (self) |
def | local_vars (self) |
def | gen_code (self, parent) |
Base class representing a call to a sub-program unit from within the PSy layer. It is possible for this unit to be in-lined within the PSy layer. :param parent: parent of this node in the PSyIR. :type parent: sub-class of :py:class:`psyclone.psyir.nodes.Node` :param call: information on the call itself, as obtained by parsing \ the Algorithm layer code. :type call: :py:class:`psyclone.parse.algorithm.KernelCall` :param str name: the name of the routine being called. :param ArgumentsClass: class to create the object that holds all \ information on the kernel arguments, as extracted from kernel \ meta-data (and accessible here via call.ktype). :type ArgumentsClass: type of :py:class:`psyclone.psyGen.Arguments` :param bool check: whether to check for consistency between the \ kernel metadata and the algorithm layer. Defaults to True. :raises GenerationError: if any of the arguments to the call are \ duplicated.
def psyclone.psyGen.Kern.args | ( | self | ) |
Return the list of arguments associated with this node. Overide the base method and simply return our arguments.
Definition at line 1080 of file psyGen.py.
References psyclone.psyGen.Kern.arguments(), and psyclone.psyir.nodes.call.Call.arguments().
def psyclone.psyGen.Kern.is_coloured | ( | self | ) |
:returns: True if this kernel is being called from within a \ coloured loop. :rtype: bool
Definition at line 1329 of file psyGen.py.
References psyclone.domain.common.psylayer.psyloop.PSyLoop._iterates_over, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._iterates_over, psyclone.parse.kernel.KernelType._iterates_over, psyclone.psyGen.Kern._iterates_over, and psyclone.psyir.nodes.node.Node.ancestor().
def psyclone.psyGen.Kern.is_reduction | ( | self | ) |
:returns: whether this kernel/built-in contains a reduction variable. :rtype: bool
Definition at line 1111 of file psyGen.py.
References psyclone.psyGen.Kern._reduction, and psyclone.psyGen.BuiltIn._reduction.
def psyclone.psyGen.Kern.local_reduction_name | ( | self | ) |
:returns: a local reduction variable name that is unique for the current reduction argument name. This is used for thread-local reductions with reproducible reductions. :rtype: str
Definition at line 1145 of file psyGen.py.
References psyclone.psyGen.Kern.reduction_arg().
def psyclone.psyGen.Kern.name | ( | self | ) |
:returns: the name of the kernel. :rtype: str
Definition at line 1313 of file psyGen.py.
References psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._name, psyclone.parse.algorithm.FileInfo._name, psyclone.parse.algorithm.InvokeCall._name, psyclone.parse.kernel.KernelProcedure._name, psyclone.parse.kernel.KernelType._name, psyclone.parse.module_info.ModuleInfo._name, psyclone.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, and psyclone.psyir.symbols.symbol.Symbol._name.
def psyclone.psyGen.Kern.name | ( | self, | |
value | |||
) |
Set the name of the kernel. :param str value: The name of the kernel.
Definition at line 1321 of file psyGen.py.
References psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._name, psyclone.parse.algorithm.FileInfo._name, psyclone.parse.algorithm.InvokeCall._name, psyclone.parse.kernel.KernelProcedure._name, psyclone.parse.kernel.KernelType._name, psyclone.parse.module_info.ModuleInfo._name, psyclone.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, psyclone.psyir.symbols.symbol.Symbol._name, and psyclone.psyGen.Kern.name().
def psyclone.psyGen.Kern.node_str | ( | self, | |
colour = True |
|||
) |
Returns the name of this node with (optional) control codes to generate coloured output in a terminal that supports it. :param bool colour: whether or not to include colour control codes. :returns: description of this node, possibly coloured. :rtype: str
Reimplemented in psyclone.psyGen.InlinedKern, and psyclone.psyGen.CodedKern.
Definition at line 1085 of file psyGen.py.
References psyclone.psyGen.Kern.arguments(), psyclone.psyir.nodes.call.Call.arguments(), psyclone.psyir.nodes.node.Node.coloured_name(), psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.name, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.name(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.name(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.name(), psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.name, psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.name(), psyclone.domain.nemo.transformations.create_nemo_loop_trans.CreateNemoLoopTrans.name(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.name(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.name(), psyclone.dynamo0p3.DynamoPSy.name(), psyclone.expression.FunctionVar.name, psyclone.expression.NamedArg.name(), psyclone.gocean1p0.GOKernelGridArgument.name(), psyclone.gocean1p0.GOStencil.name(), psyclone.parse.algorithm.FileInfo.name(), psyclone.parse.algorithm.InvokeCall.name(), psyclone.parse.kernel.KernelProcedure.name(), psyclone.parse.kernel.KernelType.name(), psyclone.parse.module_info.ModuleInfo.name(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.name(), psyclone.psyGen.PSy.name(), psyclone.psyGen.Invoke.name(), psyclone.psyGen.Kern.name(), psyclone.psyGen.CodedKern.name, psyclone.psyGen.Argument.name(), psyclone.psyGen.Transformation.name(), psyclone.psyGen.DummyTransformation.name(), psyclone.psyir.nodes.container.Container.name, psyclone.psyir.nodes.member.Member.name, psyclone.psyir.nodes.reference.Reference.name(), psyclone.psyir.nodes.routine.Routine.name, psyclone.psyir.symbols.symbol.Symbol.name(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.name(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.name(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.name(), psyclone.psyir.transformations.loop_trans.LoopTrans.name(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.name(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.name(), psyclone.transformations.OMPSingleTrans.name(), psyclone.transformations.OMPMasterTrans.name(), psyclone.transformations.OMPParallelTrans.name(), psyclone.transformations.MoveTrans.name(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.name(), psyclone.transformations.Dynamo0p3KernelConstTrans.name(), psyclone.transformations.ACCEnterDataTrans.name(), psyclone.transformations.ACCRoutineTrans.name(), psyclone.transformations.ACCKernelsTrans.name(), psyclone.transformations.ACCDataTrans.name(), and psyclone.transformations.KernelImportsToArguments.name().
def psyclone.psyGen.Kern.reduction_arg | ( | self | ) |
:returns: the reduction variable if this kernel/built-in contains one and `None` otherwise. :rtype: :py:class:`psyclone.psyGen.KernelArgument` or `NoneType`
Definition at line 1120 of file psyGen.py.
References psyclone.psyGen.Kern._reduction_arg.
def psyclone.psyGen.Kern.reduction_sum_loop | ( | self, | |
parent | |||
) |
Generate the appropriate code to place after the end parallel region. :param parent: the Node in the f2pygen AST to which to add new code. :type parent: :py:class:`psyclone.f2pygen.SubroutineGen` :raises GenerationError: for an unsupported reduction access in \ LFRicBuiltIn.
Definition at line 1224 of file psyGen.py.
References psyclone.domain.lfric.lfric_kern_metadata.LFRicKernMetadata._arg_descriptors, psyclone.gocean1p0.GOKernelType1p0._arg_descriptors, psyclone.parse.kernel.KernelType._arg_descriptors, psyclone.psyGen.Kern._arg_descriptors, psyclone.psyGen.BuiltIn._arg_descriptors, psyclone.domain.lfric.lfric_kern.LFRicKern._arguments, psyclone.psyGen.Kern._arguments, psyclone.psyGen.InlinedKern._arguments, psyclone.psyGen.Kern._reduction_arg, psyclone.psyGen.Kern._reduction_reference(), psyclone.psyGen.Kern.local_reduction_name(), psyclone.psyGen.Kern.reduction_arg(), psyclone.psyGen.Kern.reprod_reduction(), psyclone.psyir.nodes.node.Node.scope(), and psyclone.psyir.symbols.symbol_table.SymbolTable.scope().
def psyclone.psyGen.Kern.reference_accesses | ( | self, | |
var_accesses | |||
) |
Get all variable access information. The API specific classes add the accesses to the arguments. So the code here only calls the baseclass, and increases the location. :param var_accesses: VariablesAccessInfo instance that stores the \ information about variable accesses. :type var_accesses: \ :py:class:`psyclone.core.VariablesAccessInfo`
Reimplemented in psyclone.gocean1p0.GOKern, psyclone.domain.lfric.lfric_kern.LFRicKern, and psyclone.domain.lfric.lfric_builtins.LFRicBuiltIn.
Definition at line 1097 of file psyGen.py.
def psyclone.psyGen.Kern.reprod_reduction | ( | self | ) |
:returns: whether this kernel/built-in is enclosed within an OpenMP do loop. If so report whether it has the reproducible flag set. Note, this also catches OMPParallelDo Directives but they have reprod set to False so it is OK. :rtype: bool
Definition at line 1130 of file psyGen.py.
References psyclone.psyir.nodes.node.Node.ancestor().
def psyclone.psyGen.Kern.zero_reduction_variable | ( | self, | |
parent, | |||
position = None |
|||
) |
Generate code to zero the reduction variable and to zero the local reduction variable if one exists. The latter is used for reproducible reductions, if specified. :param parent: the Node in the AST to which to add new code. :type parent: :py:class:`psyclone.psyir.nodes.Node` :param str position: where to position the new code in the AST. :raises GenerationError: if the variable to zero is not a scalar. :raises GenerationError: if the reprod_pad_size (read from the \ configuration file) is less than 1. :raises GenerationError: for a reduction into a scalar that is \ neither 'real' nor 'integer'.
Definition at line 1158 of file psyGen.py.
References psyclone.psyGen.Kern._reduction_arg, psyclone.psyGen.Kern.local_reduction_name(), psyclone.psyGen.Kern.reprod_reduction(), psyclone.psyir.nodes.node.Node.scope(), and psyclone.psyir.symbols.symbol_table.SymbolTable.scope().