📄 comm_inln.h
字号:
// -*- c++ -*-// // Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana// University Research and Technology// Corporation. All rights reserved.// Copyright (c) 2004-2005 The University of Tennessee and The University// of Tennessee Research Foundation. All rights// reserved.// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, // University of Stuttgart. All rights reserved.// Copyright (c) 2004-2005 The Regents of the University of California.// All rights reserved.// Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.// $COPYRIGHT$// // Additional copyrights may follow// // $HEADER$// //// Point-to-Point//inline voidMPI::Comm::Send(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ (void)MPI_Send(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm);}inline voidMPI::Comm::Recv(void *buf, int count, const MPI::Datatype & datatype, int source, int tag, MPI::Status & status) const{ (void)MPI_Recv(buf, count, datatype, source, tag, mpi_comm, &status.mpi_status);}inline voidMPI::Comm::Recv(void *buf, int count, const MPI::Datatype & datatype, int source, int tag) const{ (void)MPI_Recv(buf, count, datatype, source, tag, mpi_comm, MPI_STATUS_IGNORE);}inline voidMPI::Comm::Bsend(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ (void)MPI_Bsend(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm);}inline voidMPI::Comm::Ssend(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const { (void)MPI_Ssend(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm);}inline voidMPI::Comm::Rsend(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ (void)MPI_Rsend(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm);}inline MPI::RequestMPI::Comm::Isend(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Isend(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::RequestMPI::Comm::Ibsend(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Ibsend(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::RequestMPI::Comm::Issend(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Issend(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::RequestMPI::Comm::Irsend(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Irsend(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::RequestMPI::Comm::Irecv(void *buf, int count, const MPI::Datatype & datatype, int source, int tag) const{ MPI_Request request; (void)MPI_Irecv(buf, count, datatype, source, tag, mpi_comm, &request); return request;}inline boolMPI::Comm::Iprobe(int source, int tag, MPI::Status & status) const{ int t; (void)MPI_Iprobe(source, tag, mpi_comm, &t, &status.mpi_status); return OPAL_INT_TO_BOOL(t);} inline boolMPI::Comm::Iprobe(int source, int tag) const{ int t; (void)MPI_Iprobe(source, tag, mpi_comm, &t, MPI_STATUS_IGNORE); return OPAL_INT_TO_BOOL(t);}inline voidMPI::Comm::Probe(int source, int tag, MPI::Status & status) const{ (void)MPI_Probe(source, tag, mpi_comm, &status.mpi_status);}inline voidMPI::Comm::Probe(int source, int tag) const{ (void)MPI_Probe(source, tag, mpi_comm, MPI_STATUS_IGNORE);}inline MPI::PrequestMPI::Comm::Send_init(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Send_init(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::PrequestMPI::Comm::Bsend_init(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Bsend_init(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::PrequestMPI::Comm::Ssend_init(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Ssend_init(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::PrequestMPI::Comm::Rsend_init(const void *buf, int count, const MPI::Datatype & datatype, int dest, int tag) const{ MPI_Request request; (void)MPI_Rsend_init(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm, &request); return request;}inline MPI::PrequestMPI::Comm::Recv_init(void *buf, int count, const MPI::Datatype & datatype, int source, int tag) const{ MPI_Request request; (void)MPI_Recv_init(buf, count, datatype, source, tag, mpi_comm, &request); return request;}inline voidMPI::Comm::Sendrecv(const void *sendbuf, int sendcount, const MPI::Datatype & sendtype, int dest, int sendtag, void *recvbuf, int recvcount, const MPI::Datatype & recvtype, int source, int recvtag, MPI::Status & status) const{ (void)MPI_Sendrecv(const_cast<void *>(sendbuf), sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, mpi_comm, &status.mpi_status);}inline voidMPI::Comm::Sendrecv(const void *sendbuf, int sendcount, const MPI::Datatype & sendtype, int dest, int sendtag, void *recvbuf, int recvcount, const MPI::Datatype & recvtype, int source, int recvtag) const{ (void)MPI_Sendrecv(const_cast<void *>(sendbuf), sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, mpi_comm, MPI_STATUS_IGNORE);}inline voidMPI::Comm::Sendrecv_replace(void *buf, int count, const MPI::Datatype & datatype, int dest, int sendtag, int source, int recvtag, MPI::Status & status) const { (void)MPI_Sendrecv_replace(buf, count, datatype, dest, sendtag, source, recvtag, mpi_comm, &status.mpi_status);}inline voidMPI::Comm::Sendrecv_replace(void *buf, int count, const MPI::Datatype & datatype, int dest, int sendtag, int source, int recvtag) const { (void)MPI_Sendrecv_replace(buf, count, datatype, dest, sendtag, source, recvtag, mpi_comm, MPI_STATUS_IGNORE);}//// Groups, Contexts, and Communicators//inline MPI::GroupMPI::Comm::Get_group() const { MPI_Group group; (void)MPI_Comm_group(mpi_comm, &group); return group;} inline intMPI::Comm::Get_size() const { int size; (void)MPI_Comm_size (mpi_comm, &size); return size;} inline intMPI::Comm::Get_rank() const { int rank; (void)MPI_Comm_rank (mpi_comm, &rank); return rank;} inline intMPI::Comm::Compare(const MPI::Comm & comm1, const MPI::Comm & comm2){ int result; (void)MPI_Comm_compare(comm1, comm2, &result); return result;}inline voidMPI::Comm::Free(void) { (void)MPI_Comm_free(&mpi_comm);}inline boolMPI::Comm::Is_inter() const{ int t; (void)MPI_Comm_test_inter(mpi_comm, &t); return OPAL_INT_TO_BOOL(t);}//// Collective Communication//inline voidMPI::Comm::Barrier() const{ (void)MPI_Barrier(mpi_comm);}inline voidMPI::Comm::Bcast(void *buffer, int count, const MPI::Datatype& datatype, int root) const{ (void)MPI_Bcast(buffer, count, datatype, root, mpi_comm);}inline voidMPI::Comm::Gather(const void *sendbuf, int sendcount, const MPI::Datatype & sendtype, void *recvbuf, int recvcount, const MPI::Datatype & recvtype, int root) const{ (void)MPI_Gather(const_cast<void *>(sendbuf), sendcount, sendtype, recvbuf, recvcount, recvtype, root, mpi_comm);}inline voidMPI::Comm::Gatherv(const void *sendbuf, int sendcount, const MPI::Datatype & sendtype, void *recvbuf, const int recvcounts[], const int displs[], const MPI::Datatype & recvtype, int root) const{ (void)MPI_Gatherv(const_cast<void *>(sendbuf), sendcount, sendtype, recvbuf, const_cast<int *>(recvcounts), const_cast<int *>(displs), recvtype, root, mpi_comm);}inline voidMPI::Comm::Scatter(const void *sendbuf, int sendcount, const MPI::Datatype & sendtype, void *recvbuf, int recvcount, const MPI::Datatype & recvtype, int root) const{ (void)MPI_Scatter(const_cast<void *>(sendbuf), sendcount, sendtype, recvbuf, recvcount, recvtype, root, mpi_comm);}inline voidMPI::Comm::Scatterv(const void *sendbuf, const int sendcounts[], const int displs[], const MPI::Datatype & sendtype, void *recvbuf, int recvcount,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -