Exemple #1
0
    def enter_main(self,
                   context,
                   comm,
                   args):
        sendbuf, sendcount, sendtype, \
            recvbuf, recvcount, recvtype, root = args
        check.check_rank(context, comm, root, 7, False, False)
        self.check_root(context, comm, root)

        rank = context.state.get_rank(comm)
        if self.root == rank:
            self.recvbuf = recvbuf
            self.recvtype = check.check_datatype(context, recvtype, 7)
            check.check_count(context, recvcount, 5)
            self.recvcount = recvcount

        self.sendtype = sendtype
        self.sendcount = sendcount

        assert self.buffers[rank] is None

        if sendbuf == consts.MPI_IN_PLACE:
            if rank != root:
                context.add_error_and_throw(errormsg.InvalidInPlace(context))
        else:
            self.make_buffer_for_root(
                context, rank, comm, sendbuf, sendtype, sendcount)
Exemple #2
0
    def enter_main(self, context, comm, args):
        sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype = args

        rank = context.state.get_rank(comm)
        self.recvbufs[rank] = recvbuf
        self.recvtypes[rank] = check.check_datatype(context, recvtype, 7)
        check.check_count(context, recvcount, 5)
        self.recvcounts[rank] = recvcount
        self.make_buffer_for_all(context, rank, comm, sendbuf, sendtype, sendcount)
Exemple #3
0
 def enter_main(self, context, comm, args):
     sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype = args
     rank = context.state.get_rank(comm)
     assert self.buffers[rank] is None
     self.make_buffer_for_all(context, rank, comm, sendbuf, sendtype, sendcount)
     recvtype = check.check_datatype(context, recvtype, 7)
     self.recvtypes[rank] = recvtype
     self.recvbufs[rank] = recvbuf
     self.recvcounts[rank] = context.controller.read_ints(recvcounts, self.process_count)
     self.displs[rank] = context.controller.read_ints(displs, self.process_count)
Exemple #4
0
def MPI_Type_free(context, args):
    datatype_ptr = args[0]
    type_id = context.controller.read_int(datatype_ptr)
    datatype = check.check_datatype(context, type_id, 1, True)

    if datatype.is_buildin():
        e = errormsg.RemovingBuildinDatatype(context, datatype=datatype)
        context.add_error_and_throw(e)

    context.state.remove_datatype(datatype)
    context.controller.write_int(datatype_ptr, consts.MPI_DATATYPE_NULL)
    return False
Exemple #5
0
    def enter_main(self, context, comm, args):
        sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root = args
        check.check_rank(context, comm, root, 8)
        rank = context.state.get_rank(comm)
        self.check_root(context, comm, root)

        self.make_buffer_for_root(context, rank, comm, sendbuf, sendtype, sendcount)

        if root == rank:
            recvtype = check.check_datatype(context, recvtype, 7)
            self.recvtype = recvtype
            self.recvbuf = recvbuf
            self.recvcounts = context.controller.read_ints(recvcounts, self.process_count)
            self.displs = context.controller.read_ints(displs, self.process_count)
Exemple #6
0
 def enter_main(self, context, comm, args):
     sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root = args
     check.check_rank(context, comm, root, 8)
     self.check_root(context, comm, root)
     rank = context.state.get_rank(comm)
     self.recvbufs[rank] = recvbuf
     self.recvtypes[rank] = recvtype
     self.recvcounts[rank] = recvcount
     if self.root == rank:
         sendtype = check.check_datatype(context, sendtype, 4)
         self.sendtype = sendtype
         self.sendcounts = context.controller.read_ints(sendcounts, self.process_count)
         self.displs = context.controller.read_ints(displs, self.process_count)
         sendcount = max(s + d for s, d in zip(self.sendcounts, self.displs))
         self.make_buffer_for_all(context, rank, comm, sendbuf, sendtype, sendcount)
Exemple #7
0
    def enter_main(self, context, comm, args):
        sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root = args
        check.check_rank(context, comm, root, 8)
        self.check_root(context, comm, root)
        rank = context.state.get_rank(comm)
        self.recvbufs[rank] = recvbuf
        self.recvtypes[rank] = recvtype
        self.recvcounts[rank] = recvcount

        if self.root == rank:
            check.check_count(context, sendcount, 2)
            sendtype = check.check_datatype(context, sendtype, 3)
            self.sendtype = sendtype
            self.sendcount = sendcount
            self.make_buffer_for_all(context, rank, comm, sendbuf, sendtype, sendcount * self.process_count)
        elif recvbuf == consts.MPI_IN_PLACE:
            context.add_error_and_throw(errormsg.InvalidInPlace(context))
Exemple #8
0
 def convert(cls, value, arg_position, context):
     return check.check_datatype(context, value, arg_position, True)
Exemple #9
0
def MPI_Type_commit(context, args):
    datatype_ptr = args[0]
    type_id = context.controller.read_int(datatype_ptr)
    datatype = check.check_datatype(context, type_id, 1, True)
    context.state.commit_datatype(datatype)
    return False