我在cygwin下安装了 4.6.1版本的openmpi和 12.4版本gfortran。
发现在MPI_Allreduce使用MPI_IN_PLACE变量时,逻辑变量pass_local经过归约后结果为.false.,如果不使用MPI_IN_PLACE,结果是没问题的,返回值为.true.。
请问这是什么原因呢,谢谢大家。
program test
use mpi
implicit none
integer :: ierr
integer :: myid, nprocs
integer :: pass_local, pass_global
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr)
pass_local = .true.
write(*,*) "Process 1 ", pass_local
call MPI_Allreduce(MPI_IN_PLACE, pass_local, 1, MPI_LOGICAL, MPI_LAND, MPI_COMM_WORLD, ierr)
write(*,*) "Process 2 ", pass_local
call MPI_FINALIZE(ierr)
end program
相似问题