首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在cygwin和openmpi下,调用mpi_allreduce函数结果有误?

在cygwin和openmpi下,调用mpi_allreduce函数结果有误?

提问于 2024-09-06 16:18:24
回答 0关注 0查看 9

我在cygwin下安装了 4.6.1版本的openmpi和 12.4版本gfortran。

发现在MPI_Allreduce使用MPI_IN_PLACE变量时,逻辑变量pass_local经过归约后结果为.false.,如果不使用MPI_IN_PLACE,结果是没问题的,返回值为.true.。

请问这是什么原因呢,谢谢大家。

代码语言:javascript
复制
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

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档