一个简单的测试代码:
[zhuangzhanpeng@node1 example]$ cat test.f90
include 'mpif.h'
integer :: ierr, pid, npe
call MPI_INIT(ierr)
mpi_comm = MPI_COMM_WORLD
call MPI_COMM_RANK(mpi_comm, pid, ierr)
call MPI_COMM_SIZE(mpi_comm, npe, ierr)
print*,pid,'1'
call MPI_Barrier(MPI_COMM_WORLD)
print*,pid,'2'
call MPI_FINALIZE(ierr)
end
0 1
1 1
[node1:13888] *** Process received signal ***
[node1:13888] Signal: Segmentation fault (11)
[node1:13888] Signal code: Address not mapped (1)
[node1:13888] Failing at address: 0x1
[node1:13889] *** Process received signal ***
[node1:13889] Signal: Segmentation fault (11)
[node1:13889] Signal code: Address not mapped (1)
[node1:13889] Failing at address: 0x1
[node1:13888] *** End of error message ***
[node1:13889] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 1 with PID 13889 on node node1 exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------
其中mpif90基于的编译器是pgf90,难道是编译器的问题??
mpi并行问题,MPI_Barrier直接报错???
答案:2 悬赏:80
解决时间 2021-02-28 03:06
- 提问者网友:無奈小影
- 2021-02-27 19:57
最佳答案
- 二级知识专家网友:陪我到地狱流浪
- 2021-02-27 21:31
后面少了一个参数,写成这样就好了
call MPI_Barrier(mpi_comm,ierr)
call MPI_Barrier(mpi_comm,ierr)
全部回答
- 1楼网友:猖狂的痴情人
- 2021-02-27 22:02
这个是正常的。
因为虽然逻辑上的确如此,但是输出是有缓存的,也就是说输出的顺序不一定是逻辑的顺序。。大致是这个意思,,我也不是计算机系的,表述可能不严格。
如果你在mpi_barrier()后加上fflush(stdout)应该输出的就是逻辑的顺序了。。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯