Example #1
0
 def local_to_global_end(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_end(self.sf, dat, mtype, True, op=op)
Example #2
0
 def local_to_global_end(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_end(self.sf, dat, mtype, True, op=op)
Example #3
0
    def end(self, dat, reverse=False):
        """End a halo exchange.

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

        See also :meth:`.begin`."""
        if self.comm.size == 1:
            return
        mtype = _get_mtype(dat)
        maybe_setflags(dat._data, write=True)
        dmplex.halo_end(self.sf, dat, mtype, reverse)
        maybe_setflags(dat._data, write=False)
Example #4
0
    def end(self, dat, reverse=False):
        """End a halo exchange.

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

        See also :meth:`.begin`."""
        if self.comm.size == 1:
            return
        mtype = _get_mtype(dat)
        maybe_setflags(dat._data, write=True)
        dmplex.halo_end(self.sf, dat, mtype, reverse)
        maybe_setflags(dat._data, write=False)
Example #5
0
 def local_to_global_end(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_end(self.sf, dat, mtype, True, op=op)
Example #6
0
 def global_to_local_end(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_end(self.sf, dat, mtype, False)
Example #7
0
 def global_to_local_end(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_end(self.sf, dat, mtype, False)