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