Reference Guide  2.5.0
psyclone.psyGen.HaloExchange Class Reference
Inheritance diagram for psyclone.psyGen.HaloExchange:
Collaboration diagram for psyclone.psyGen.HaloExchange:

Public Member Functions

def __init__ (self, field, check_dirty=True, vector_index=None, parent=None)
 
def vector_index (self)
 
def halo_depth (self)
 
def halo_depth (self, value)
 
def field (self)
 
def dag_name (self)
 
def args (self)
 
def check_vector_halos_differ (self, node)
 
def node_str (self, colour=True)
 

Public Attributes

 vector_index
 

Detailed Description

Generic Halo Exchange class which can be added to and
manipulated in, a schedule.

:param field: the field that this halo exchange will act on
:type field: :py:class:`psyclone.dynamo0p3.DynKernelArgument`
:param check_dirty: optional argument default True indicating whether \
                    this halo exchange should be subject to a run-time \
                    check for clean/dirty halos.
:type check_dirty: bool
:param vector_index: optional vector index (default None) to identify \
                     which index of a vector field this halo exchange is \
                     responsible for.
:type vector_index: int
:param parent: optional parent (default None) of this object
:type parent: :py:class:`psyclone.psyir.nodes.Node`

Definition at line 841 of file psyGen.py.

Member Function Documentation

◆ args()

def psyclone.psyGen.HaloExchange.args (   self)
Return the list of arguments associated with this node. Overide the
base method and simply return our argument. 

Definition at line 920 of file psyGen.py.

920  def args(self):
921  '''Return the list of arguments associated with this node. Overide the
922  base method and simply return our argument. '''
923  return [self._field]
924 

References psyclone.domain.common.psylayer.psyloop.PSyLoop._field, psyclone.domain.lfric.arg_index_to_metadata_index.ArgIndexToMetadataIndex._field(), psyclone.domain.lfric.lfric_loop.LFRicLoop._field, psyclone.domain.lfric.metadata_to_arguments_rules.MetadataToArgumentsRules._field(), and psyclone.psyGen.HaloExchange._field.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_vector_halos_differ()

def psyclone.psyGen.HaloExchange.check_vector_halos_differ (   self,
  node 
)
Helper method which checks that two halo exchange nodes (one being
self and the other being passed by argument) operating on the
same field, both have vector fields of the same size and use
different vector indices. If this is the case then the halo
exchange nodes do not depend on each other. If this is not the
case then an internal error will have occured and we raise an
appropriate exception.

:param node: a halo exchange which should exchange the same field as \
             self.
:type node: :py:class:`psyclone.psyGen.HaloExchange`
:raises GenerationError: if the argument passed is not a halo exchange.
:raises GenerationError: if the field name in the halo exchange \
                         passed in has a different name to the field \
                         in this halo exchange.
:raises GenerationError: if the field in this halo exchange is not a \
                         vector field
:raises GenerationError: if the vector size of the field in this halo \
                         exchange is different to vector size of the \
                         field in the halo exchange passed by argument.
:raises GenerationError: if the vector index of the field in this \
                         halo exchange is the same as the vector \
                         index of the field in the halo exchange \
                         passed by argument.

Definition at line 925 of file psyGen.py.

925  def check_vector_halos_differ(self, node):
926  '''Helper method which checks that two halo exchange nodes (one being
927  self and the other being passed by argument) operating on the
928  same field, both have vector fields of the same size and use
929  different vector indices. If this is the case then the halo
930  exchange nodes do not depend on each other. If this is not the
931  case then an internal error will have occured and we raise an
932  appropriate exception.
933 
934  :param node: a halo exchange which should exchange the same field as \
935  self.
936  :type node: :py:class:`psyclone.psyGen.HaloExchange`
937  :raises GenerationError: if the argument passed is not a halo exchange.
938  :raises GenerationError: if the field name in the halo exchange \
939  passed in has a different name to the field \
940  in this halo exchange.
941  :raises GenerationError: if the field in this halo exchange is not a \
942  vector field
943  :raises GenerationError: if the vector size of the field in this halo \
944  exchange is different to vector size of the \
945  field in the halo exchange passed by argument.
946  :raises GenerationError: if the vector index of the field in this \
947  halo exchange is the same as the vector \
948  index of the field in the halo exchange \
949  passed by argument.
950 
951  '''
952 
953  if not isinstance(node, HaloExchange):
954  raise GenerationError(
955  "Internal error, the argument passed to "
956  "HaloExchange.check_vector_halos_differ() is not "
957  "a halo exchange object")
958 
959  if self.field.name != node.field.name:
960  raise GenerationError(
961  f"Internal error, the halo exchange object passed to "
962  f"HaloExchange.check_vector_halos_differ() has a different "
963  f"field name '{node.field.name}' to self '{self.field.name}'")
964 
965  if self.field.vector_size <= 1:
966  raise GenerationError(
967  "Internal error, HaloExchange.check_vector_halos_differ() "
968  "a halo exchange depends on another halo exchange but the "
969  f"vector size of field '{self.field.name}' is 1")
970 
971  if self.field.vector_size != node.field.vector_size:
972  raise GenerationError(
973  f"Internal error, HaloExchange.check_vector_halos_differ() "
974  f"a halo exchange depends on another halo exchange but the "
975  f"vector sizes for field '{self.field.name}' differ")
976 
977  if self.vector_index == node.vector_index:
978  raise GenerationError(
979  f"Internal error, HaloExchange.check_vector_halos_differ() "
980  f"a halo exchange depends on another halo exchange but both "
981  f"vector id's ('{self.vector_index}') of field "
982  f"'{self.field.name}' are the same")
983 

References psyclone.domain.common.psylayer.psyloop.PSyLoop.field, psyclone.psyGen.HaloExchange.field(), psyclone.domain.lfric.arg_ordering.ArgOrdering.field(), psyclone.domain.lfric.kern_call_arg_list.KernCallArgList.field(), psyclone.domain.lfric.kern_call_invoke_arg_list.KernCallInvokeArgList.field(), psyclone.domain.lfric.kern_stub_arg_list.KernStubArgList.field(), psyclone.domain.lfric.kernel_interface.KernelInterface.field(), and psyclone.psyGen.HaloExchange.vector_index.

Here is the call graph for this function:

◆ dag_name()

def psyclone.psyGen.HaloExchange.dag_name (   self)
:returns: the name to use in a dag for this node.
:rtype: str

Definition at line 909 of file psyGen.py.

909  def dag_name(self):
910  '''
911  :returns: the name to use in a dag for this node.
912  :rtype: str
913  '''
914  name = f"{self._text_name}({self._field.name})_{self.position}"
915  if self._check_dirty:
916  name = "check" + name
917  return name
918 

References psyclone.psyGen.HaloExchange._check_dirty.

Here is the caller graph for this function:

◆ field()

def psyclone.psyGen.HaloExchange.field (   self)
 Return the field that the halo exchange acts on 

Definition at line 904 of file psyGen.py.

904  def field(self):
905  ''' Return the field that the halo exchange acts on '''
906  return self._field
907 

References psyclone.domain.common.psylayer.psyloop.PSyLoop._field, psyclone.domain.lfric.arg_index_to_metadata_index.ArgIndexToMetadataIndex._field(), psyclone.domain.lfric.lfric_loop.LFRicLoop._field, psyclone.domain.lfric.metadata_to_arguments_rules.MetadataToArgumentsRules._field(), and psyclone.psyGen.HaloExchange._field.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ halo_depth() [1/2]

def psyclone.psyGen.HaloExchange.halo_depth (   self)
 Return the depth of the halo exchange 

Definition at line 894 of file psyGen.py.

894  def halo_depth(self):
895  ''' Return the depth of the halo exchange '''
896  return self._halo_depth
897 

References psyclone.psyGen.HaloExchange._halo_depth.

Here is the caller graph for this function:

◆ halo_depth() [2/2]

def psyclone.psyGen.HaloExchange.halo_depth (   self,
  value 
)
 Set the depth of the halo exchange 

Definition at line 899 of file psyGen.py.

899  def halo_depth(self, value):
900  ''' Set the depth of the halo exchange '''
901  self._halo_depth = value
902 

References psyclone.psyGen.HaloExchange._halo_depth, and psyclone.psyGen.HaloExchange.halo_depth().

Here is the call graph for this function:

◆ node_str()

def psyclone.psyGen.HaloExchange.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.dynamo0p3.LFRicHaloExchange.

Definition at line 984 of file psyGen.py.

984  def node_str(self, colour=True):
985  '''
986  Returns the name of this node with (optional) control codes
987  to generate coloured output in a terminal that supports it.
988 
989  :param bool colour: whether or not to include colour control codes.
990 
991  :returns: description of this node, possibly coloured.
992  :rtype: str
993  '''
994  return (f"{self.coloured_name(colour)}[field='{self._field.name}', "
995  f"type='{self._halo_type}', depth={self._halo_depth}, "
996  f"check_dirty={self._check_dirty}]")
997 
998 
Here is the caller graph for this function:

◆ vector_index()

def psyclone.psyGen.HaloExchange.vector_index (   self)
If the field is a vector then return the vector index associated
with this halo exchange. Otherwise return None

Definition at line 888 of file psyGen.py.

888  def vector_index(self):
889  '''If the field is a vector then return the vector index associated
890  with this halo exchange. Otherwise return None'''
891  return self._vector_index
892 

References psyclone.psyGen.HaloExchange._vector_index.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: