Exemple #1
0
 def local_to_global_begin(self, dat, insert_mode):
     assert insert_mode in {op2.INC, op2.MIN, op2.MAX}, "%s LtoG not supported" % insert_mode
     if self.comm.size == 1:
         return
     mtype, builtin = _get_mtype(dat)
     op = {(False, op2.INC): MPI.SUM,
           (True, op2.INC): MPI.SUM,
           (False, op2.MIN): _contig_min_op,
           (True, op2.MIN): MPI.MIN,
           (False, op2.MAX): _contig_max_op,
           (True, op2.MAX): MPI.MAX}[(builtin, insert_mode)]
     dmplex.halo_begin(self.sf, dat, mtype, True, op=op)
Exemple #2
0
 def local_to_global_begin(self, dat, insert_mode):
     assert insert_mode in {op2.INC, op2.MIN,
                            op2.MAX}, "%s LtoG not supported" % insert_mode
     if self.comm.size == 1:
         return
     mtype = _get_mtype(dat)
     op = {
         op2.INC: MPI.SUM,
         op2.MIN: MPI.MIN,
         op2.MAX: MPI.MAX
     }[insert_mode]
     dmplex.halo_begin(self.sf, dat, mtype, True, op=op)
Exemple #3
0
    def begin(self, dat, reverse=False):
        """Begin a halo exchange.

        :arg dat: The :class:`pyop2.Dat` to start a halo exchange on.
        :arg reverse: (optional) perform a reverse halo exchange.

        .. note::

           If ``reverse`` is ``True`` then the input buffer
           may not be touched before calling :meth:`.end`."""
        if self.comm.size == 1:
            return
        mtype = _get_mtype(dat)
        dmplex.halo_begin(self.sf, dat, mtype, reverse)
Exemple #4
0
    def begin(self, dat, reverse=False):
        """Begin a halo exchange.

        :arg dat: The :class:`pyop2.Dat` to start a halo exchange on.
        :arg reverse: (optional) perform a reverse halo exchange.

        .. note::

           If ``reverse`` is ``True`` then the input buffer
           may not be touched before calling :meth:`.end`."""
        if self.comm.size == 1:
            return
        mtype = _get_mtype(dat)
        dmplex.halo_begin(self.sf, dat, mtype, reverse)
Exemple #5
0
 def local_to_global_begin(self, dat, insert_mode):
     assert insert_mode in {op2.INC, op2.MIN,
                            op2.MAX}, "%s LtoG not supported" % insert_mode
     if self.comm.size == 1:
         return
     mtype, builtin = _get_mtype(dat)
     op = {
         (False, op2.INC): MPI.SUM,
         (True, op2.INC): MPI.SUM,
         (False, op2.MIN): _contig_min_op,
         (True, op2.MIN): MPI.MIN,
         (False, op2.MAX): _contig_max_op,
         (True, op2.MAX): MPI.MAX
     }[(builtin, insert_mode)]
     dmplex.halo_begin(self.sf, dat, mtype, True, op=op)
Exemple #6
0
 def global_to_local_begin(self, dat, insert_mode):
     assert insert_mode is op2.WRITE, "Only WRITE GtoL supported"
     if self.comm.size == 1:
         return
     mtype, _ = _get_mtype(dat)
     dmplex.halo_begin(self.sf, dat, mtype, False)
Exemple #7
0
 def global_to_local_begin(self, dat, insert_mode):
     assert insert_mode is op2.WRITE, "Only WRITE GtoL supported"
     if self.comm.size == 1:
         return
     mtype, _ = _get_mtype(dat)
     dmplex.halo_begin(self.sf, dat, mtype, False)