在消息传递(MPI)中,mpi_send和revv“等待什么". [英] In message passing (MPI) mpi_send and recv "what waits"

查看:177
本文介绍了在消息传递(MPI)中,mpi_send和revv“等待什么".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑配置为

第一

未缓冲,阻塞(同步)

据我了解,MPI是一个API,所以当我们执行mpi_send阻止函数调用时,发送者函数/程序是否被阻止了?

As I understand MPI is an API, so when we do the mpi_send blocking function call, does the sender function/program get blocked?

OR

MPI API函数mpi_send是否被阻塞,以便程序可以继续工作直到发送消息?

Does the MPI API function mpi_send get blocked, so that the program can continue its work till message is sent?

第二:

类似的困惑,mpi_recv是被阻塞还是被调用的函数被阻塞?

Similar confusion, does the mpi_recv get blocked or the function from where it was called gets blocked?

出现这样一个愚蠢问题的原因:

这是并行处理,那么为什么有人会做一些会阻止需要某些信息的进程的事情?

It's parallel processing so why would some one make something that would block a process who wants some info?

另一个原因:

当某个进程调用mpi_send时,可能没有其他进程可以使用mpi_send函数,因为它正在运行?!

It is possible that when mpi_send is called by a process, no other process can use the mpi_send function because it's working?!

推荐答案

首先:是的,因为在消息发送"之前MPI_Send调用不会返回,所以调用程序被阻止"了.

First: Yes, the calling program is "blocked" because the MPI_Send call will not return until the message is "sent."

第二个:MPI_Recv也是一个阻止"调用,并且直到接收到"该消息后才返回.

Second: MPI_Recv is also a "blocking" call, and will not return until the message has been "received."

一些其他信息:

MPI_Send是一个阻止"调用,因为该调用在发送消息之前不会将控制权返回给调用者.并且已发送"的定义是保存消息的用户缓冲区可以安全地重用.不能保证已收到该消息,甚至不能保证已在远程列中达到MPI_Recv调用. (确切的行为取决于实现.RDMA样式的互连会导致大多数问题与确切的在黑匣子内部"行为有关.)

MPI_Send is a "blocking" call because the call will not return control to the caller until the message has been sent. And the definition of "sent" is that the user buffer that holds the message can be safely reused. There is no guarantee that the message has been received, or even that the MPI_Recv call has been reached in the remote rank. (The exact behavior is implementation dependent. RDMA style interconnects cause the most issues with the exact "inside the black box" behavior.)

MPI_Isend是一个非阻塞"调用.控制将立即"返回到调用程序...但是,直到该程序调用MPI_Test或MPI_Wait确认消息已发送"之后,缓冲区才可以重用.

MPI_Isend is a "non blocking" call. Control will return to the calling program "instantly"...but the buffer can not be reused until the program calls MPI_Test or MPI_Wait to confirm that the message has been "sent."

阻塞"调用的目的是向调用程序提供肯定的确认,即可以重用保存消息的缓冲区(在MPI_Send的情况下)或可靠地读取和更改(在MPI_Recv的情况下).如果使用了非阻塞"(例如MPI_Isend,MPI_Irecv)调用,则调用程序可以继续执行计算,但是不能可靠地(或合法地)更改消息缓冲区,直到调用MPI_Wait或MPI_Test来完成消息事务为止.

The purpose of the "blocking" calls is to provide a positive confirmation to the calling program that the buffer holding the message can be reused (in the case of MPI_Send) or reliably read and altered (in the case of MPI_Recv). If a "non-blocking" (e.g. MPI_Isend, MPI_Irecv) call is used, the calling program can continue performing calculations, but can not reliably (or legally) alter the message buffer until MPI_Wait or MPI_Test is called to complete the message transaction.

这篇关于在消息传递(MPI)中,mpi_send和revv“等待什么".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆