【发布时间】:2021-03-16 16:30:36
【问题描述】:
由于 MPI 的集体通信没有标志参数,我想知道这是否会导致问题:
我有 2 个 MPI_communicator,它们不相等,但重叠,我想同时对它们执行 MPI_IBcast:
program main
use mpi
implicit none
integer :: comm1, comm2, ierr, me, req(2)
integer :: color1(4) = [1,1,1,0]
integer :: color2(4) = [0,1,1,1]
integer :: a, b, new_me
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, me, ierr)
a = me - 1
b = me + 1
call MPI_Comm_split(MPI_COMM_WORLD, color1(me+1), me, comm1, ierr)
call MPI_Comm_split(MPI_COMM_WORLD, color2(me+1), me, comm2, ierr)
CALL MPI_IBcast(a,1, MPI_INTEGER, 0, comm1, req(1), ierr)
CALL MPI_IBcast(b,1, MPI_INTEGER, 0, comm2, req(2), ierr)
call MPI_Waitall(2, req, MPI_STATUSES_IGNORE, ierr)
call MPI_Finalize(ierr)
write (*,*) me, a, b
end program main
它在我的本地机器上运行良好,但我的问题是:这能保证工作还是我必须使用 MPI_Bcast,而不是 MPI_Ibcast?
【问题讨论】: