通过的openmpi无阻塞数据共享 [英] Non-blocking data sharing through OpenMPI
问题描述
我试图利用跨多个的openmpi工人US $ p $垫数据,但是,我做的数据划分在一个相当的定制方式,是的不的服从 MPI_Scatter
或 MPI_Broadcast
。我想这样做是给每个处理器队列中,使得他们可以做数据的第一块自己的工作,走下一大块,重复一些工作(或其他一些异步机制),直到没有更多的块。
I'm trying to spread data across multiple workers using OpenMPI, however, I'm doing the data division in a fairly custom way that is not amenable to MPI_Scatter
or MPI_Broadcast
. What I would like to do is to give each processor some work in a queue (or, some other async mechanism) such that they can do their work on the first chunk of data, take the next chunk, repeat until no more chunks.
我知道的 MPI_Isend
,但是如果我发送数据与 MPI_Isend
我不能修改它,直到它完成发送;迫使我使用 MPI_WAIT
,因此不必等到线程完成反正接收数据!
I know of MPI_Isend
, however if I send data with MPI_Isend
I can't modify it until it's finished sending; forcing me to use MPI_Wait
and thus having to wait until the thread is finished receiving the data anyway!
有没有一个标准这一问题的解决方案,或者我必须重新考虑我的方法呢?
Is there a standard a solution to this problem, or must I rethink my approach?
推荐答案
使用 MPI_ISEND
并不一定意味着对端接收消息。它只是意味着缓冲区可以重复使用。这可能是因为该消息已被打开MPI或实际已在另一端收到彩信内部缓冲。这取决于你的邮件大小。
Using MPI_ISEND
doesn't necessarily mean that the message is received on the remote end. It just means that the buffer is available for reuse. It could be that the message has been buffered internally by Open MPI or that the message actually has been received on the other end. It depends on your message size.
另一种选择是让你的工人询问工作主进程,当他们需要它,而不是有它推到他们。然后根据需要主人才能进行。你可以在第一条消息做了一个 MPI_SCATTER
因为每个人都将收到一些数据。那之后,有师傅做了一个 MPI_RECV(MPI_ANY_SOURCE)
从工作进程中的一个获得的消息。
Another option would be to have your workers ask the master process for work when they need it instead of having it pushed to them. Then the master can work only as needed. You could do an MPI_SCATTER
for the first message since everyone will be receiving some data. Then after that, have the master do an MPI_RECV(MPI_ANY_SOURCE)
to get a message from one of the worker processes.
这篇关于通过的openmpi无阻塞数据共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!