简体   繁体   English

MPI_Recv带有来源列表

[英]MPI_Recv with list of sources

Is it possible to have a list of sources passed to an MPI_Recv (or equivalent) call? 是否有可能将源列表传递给MPI_Recv(或等效)调用? Currently, my code looks something like: 目前,我的代码如下所示:

do i=nod1,nod2
    call mpi_recv(tmp,n,MPI_REAL,MPI_ANY_SOURCE,tag,MPI_COMM_WORLD,status,ierr)
    ... do stuff with tmp here
    call mpi_send(tmp,n,MPI_REAL,status(MPI_SOURCE),tag,MPI_COMM_WORLD,ierr)
enddo

Of course, this doesn't guarantee that it does what I want. 当然,这并不能保证它能满足我的要求。 (if nod1 sends two messages here before nod2 can send one message, then nod2's message is not recieved during this iteration, which would be bad.) In my application, that can't happen since nod1 and nod2 have other constraints which force them to be synchronized (enough) with each other ... but it got me wondering if there is way to specify a list of procs that are permitted to be recieved from. (如果nod1在这里发送了两条消息,然后nod2可以发送一条消息,则在此迭代期间没有收到nod2的消息,这很不好。)在我的应用程序中,由于nod1和nod2还有其他约束迫使他们执行彼此同步(足够)...但是让我想知道是否有办法指定允许接收的proc列表。

Not as such. 不是这样的。 However, you can use MPI_Probe() with MPI_ANY_SOURCE , and then compare the MPI_SOURCE field of the status object against your list of processes you want to receive from. 但是,可以将MPI_Probe()MPI_ANY_SOURCE ,然后将status对象的MPI_SOURCE字段与要从中接收的进程列表进行比较。 If there's a match, you can then proceed to receive from that source with a regular blocking receive. 如果存在匹配项,则可以通过常规阻止接收从该源继续接收。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM