带有 MPI_ALLREDUCE 的浮点异常

问题描述

我使用的是 gfortran v.9.3.0 和 openmpi v.4.1.0。 当我在调试模式下编译我的应用程序时,专门使用此标志来检查浮动异常。

-ffpe-trap=invalid,zero,overflow,underflow,

调用例程时出现浮点异常:

use mpi
integer::n
double precision ::phi(n)

call MPI_AllReduce(MPI_IN_PLACE,phi,n,MPI_DOUBLE_PRECISION,MPI_SUM,MPI_COMM_WORLD,ierr)

我检查了 phi 的最小值和最大值,这两个数字都在合理范围内。

我唯一看到的是不同的排名可能有相反的数字,所以总和将为零或接近零。但这真的会触发浮动异常吗:

错误

[server-0:3718 :0:3718] Caught signal 8 (Floating point exception: floating-point underflow)
[server-0:3720 :0:3720] Caught signal 8 (Floating point exception: floating-point underflow)
[-server-0:3721 :0:3721] Caught signal 8 (Floating point exception: floating-point underflow)
==== backtrace (tid:   3718) ====
 0 0x0000000000055365 ucs_debug_print_backtrace()  /software/contrib/../src/ucs/debug/debug.c:656
 1 0x00000000000c7fa5 ompi_op_base_2buff_sum_fortran_double_precision()  op_base_functions.c:0
 2 0x00000000000a9ada ompi_coll_base_allreduce_intra_recursivedoubling()  ???:0
 3 0x00000000000056c5 ompi_coll_tuned_allreduce_intra_dec_fixed()  ???:0
 4 0x0000000000064fb9 MPI_Allreduce()  ???:0
 5 0x0000000000046739 ompi_allreduce_f()  ???:0
 6 0x000000000061f881 __parallel_MOD_global_sum_dble_vector()  mpifuncs.f90:490
 7 0x0000000000f168ee sol_()  tt1.f90:244
 8 0x000000000102a033 MAIN__()  tt.f90:66
 9 0x000000000102a449 main() tt.f90:24
10 0x0000000000022555 __libc_start_main()  ???:0
11 0x0000000000409c63 _start()  ???:0

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)