本文整理汇总了C++中mpi::Intracomm::Irecv方法的典型用法代码示例。如果您正苦于以下问题:C++ Intracomm::Irecv方法的具体用法?C++ Intracomm::Irecv怎么用?C++ Intracomm::Irecv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpi::Intracomm
的用法示例。
在下文中一共展示了Intracomm::Irecv方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recv
/*
* Receive a block.
*/
void PackedData::recv(MPI::Intracomm& comm, int source)
{
MPI::Request request;
int myRank = comm.Get_rank();
int comm_size = comm.Get_size();
// Preconditons
if (source > comm_size - 1 || source < 0) {
UTIL_THROW("Source rank out of bounds");
}
if (source == myRank) {
UTIL_THROW("Source and desination identical");
}
request = comm.Irecv(begin_, capacity_, MPI::UNSIGNED_CHAR, source, 5);
request.Wait();
cursor_ = begin_;
}
示例2: sendRecv
/*
* Send and receive buffer.
*/
void Buffer::sendRecv(MPI::Intracomm& comm, int source, int dest)
{
MPI::Request request[2];
int sendBytes = 0;
int myRank = comm.Get_rank();
int comm_size = comm.Get_size();
// Preconditions
if (dest > comm_size - 1 || dest < 0) {
UTIL_THROW("Destination rank out of bounds");
}
if (source > comm_size - 1 || source < 0) {
UTIL_THROW("Source rank out of bounds");
}
if (dest == myRank) {
UTIL_THROW("Destination and my rank are identical");
}
if (source == myRank) {
UTIL_THROW("Source and my rank are identical");
}
// Start nonblocking receive.
request[0] = comm.Irecv(recvBufferBegin_, bufferCapacity_ ,
MPI::CHAR, source, 5);
// Start nonblocking send.
sendBytes = sendPtr_ - sendBufferBegin_;
request[1] = comm.Isend(sendBufferBegin_, sendBytes , MPI::CHAR, dest, 5);
// Wait for completion of receive.
request[0].Wait();
recvPtr_ = recvBufferBegin_;
// Wait for completion of send.
request[1].Wait();
// Update statistics.
if (sendBytes > maxSendLocal_) {
maxSendLocal_ = sendBytes;
}
}
示例3: recv
/*
* Receive a buffer.
*/
void Buffer::recv(MPI::Intracomm& comm, int source)
{
MPI::Request request;
int myRank = comm.Get_rank();
int comm_size = comm.Get_size();
// Preconditons
if (source > comm_size - 1 || source < 0) {
UTIL_THROW("Source rank out of bounds");
}
if (source == myRank) {
UTIL_THROW("Source and destination identical");
}
request = comm.Irecv(recvBufferBegin_, bufferCapacity_,
MPI::CHAR, source, 5);
request.Wait();
recvType_ = NONE;
recvPtr_ = recvBufferBegin_;
}