gpt4 book ai didi

linux - IMSL 和 MPI 之间的冲突

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:22:14 28 4
gpt4 key购买 nike

我试图将我的 Fortran 代码分成几个部分,我想通过使用 MPI 并行化每个部分。对于每个部分,我使用 IMSL 库来解决优化问题(使用 BCONF)。但是,我发现 IMSL 库有它自己的关于 MPI 的子程序,它不允许我调用标准 MPI 启动子程序“Call MPI_INIT(ierror)”。它只会给我一个 fatal error 并结束程序。

我举两个例子来说明这个问题。

示例 1,从每个节点打印“Hello World”:

program main
use mpi
implicit none
integer ( kind = 4 ) error
integer ( kind = 4 ) id
integer ( kind = 4 ) p
call MPI_Init ( error )
call MPI_Comm_size ( MPI_COMM_WORLD, p, error )
call MPI_Comm_rank ( MPI_COMM_WORLD, id, error )
write ( *, * ) ' Process ', id, ' says "Hello, world!"'
call MPI_Finalize ( error )
end program

当我在没有 IMSL 库的情况下编译和运行时,它给了我正确的答案:

mpif90 -o a.out hello_mpi.f90
mpiexec -n 4 ./a.out

Process 3 says "Hello, world!"
Process 0 says "Hello, world!"
Process 2 says "Hello, world!"
Process 1 says "Hello, world!"

现在,如果我不对代码进行任何更改,只是添加 IMSL 库,则会导致错误:

mpif90 -o a.out hello_mpi.f90 $LINK_FNL_STATIC_IMSL $F90FLAGS
mpiexec -n 4 ./a.out

*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** dummy routine. Parallel performance needs a functioning MPI
*** library.
*** dummy routine. Parallel performance needs a functioning MPI
*** library.
*** dummy routine. Parallel performance needs a functioning MPI
*** library.
*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** dummy routine. Parallel performance needs a functioning MPI
*** library.

在第一个示例中,将“$LINK_FNL_STATIC_IMSL”更改为“LINK_MPI”可以解决问题,但在此处更实际的示例中不起作用:

例子2:使用MPI,每个节点使用IMSL库计算求积节点

program main
USE GQRUL_INT
use mpi
implicit none
integer ( kind = 4 ) error
integer ( kind = 4 ) id
integer ( kind = 4 ) p
real ( kind = 8 ) QW(10), QX(10)
call MPI_Init ( error )
call MPI_Comm_size ( MPI_COMM_WORLD, p, error )
call MPI_Comm_rank ( MPI_COMM_WORLD, id, error )
write ( *, * ) ' Process ', id, ' says "Hello, world!"'
CALL GQRUL (10, QX, QW )
call MPI_Finalize ( error )
end program

当我编译并运行时,程序停在“MPI_INIT”处:

mpif90 -o a.out hello_mpi.f90 $LINK_FNL_STATIC_IMSL $F90FLAGS
mpiexec -n 4 ./a.out

*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** dummy routine. Parallel performance needs a functioning MPI
*** library.
*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** dummy routine. Parallel performance needs a functioning MPI
*** library.
*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** FATAL ERROR 1 from MPI_INIT. A CALL was executed using the IMSL
*** dummy routine. Parallel performance needs a functioning MPI
*** library.
*** dummy routine. Parallel performance needs a functioning MPI
*** library.

如果我将链接选项更改为 $LINK_MPI,程序会在 IMSL 库子例程处崩溃:

mpif90 -o a.out hello_mpi.f90 $LINK_MPI $F90FLAGS
mpiexec -n 4 ./a.out

Process 1 says "Hello, world!"
Process 0 says "Hello, world!"
Process 3 says "Hello, world!"
Process 2 says "Hello, world!"
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 00000000018D5C75 Unknown Unknown Unknown
a.out 00000000018D3A37 Unknown Unknown Unknown
a.out 000000000188ADC4 Unknown Unknown Unknown
a.out 000000000188ABD6 Unknown Unknown Unknown
a.out 000000000184BCB9 Unknown Unknown Unknown
a.out 000000000184F410 Unknown Unknown Unknown
libpthread.so.0 00007EFC178C67E0 Unknown Unknown Unknown
a.out 000000000178E634 Unknown Unknown Unknown
a.out 000000000178A423 Unknown Unknown Unknown
a.out 0000000000430491 Unknown Unknown Unknown
a.out 000000000042AACD Unknown Unknown Unknown
a.out 00000000004233D2 Unknown Unknown Unknown
a.out 0000000000422FEA Unknown Unknown Unknown
a.out 0000000000422DD0 Unknown Unknown Unknown
a.out 0000000000422C9E Unknown Unknown Unknown
libc.so.6 00007EFC16F7BD1D Unknown Unknown Unknown
a.out 0000000000422B29 Unknown Unknown Unknown
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 00000000018D5C75 Unknown Unknown Unknown
a.out 00000000018D3A37 Unknown Unknown Unknown
a.out 000000000188ADC4 Unknown Unknown Unknown
a.out 000000000188ABD6 Unknown Unknown Unknown
a.out 000000000184BCB9 Unknown Unknown Unknown
a.out 000000000184F410 Unknown Unknown Unknown
libpthread.so.0 00007EFDE2A037E0 Unknown Unknown Unknown
a.out 000000000178E634 Unknown Unknown Unknown
a.out 000000000178A423 Unknown Unknown Unknown
a.out 0000000000430491 Unknown Unknown Unknown
a.out 000000000042AACD Unknown Unknown Unknown
a.out 00000000004233D2 Unknown Unknown Unknown
a.out 0000000000422FEA Unknown Unknown Unknown
a.out 0000000000422DD0 Unknown Unknown Unknown
a.out 0000000000422C9E Unknown Unknown Unknown
libc.so.6 00007EFDE20B8D1D Unknown Unknown Unknown
a.out 0000000000422B29 Unknown Unknown Unknown
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 00000000018D5C75 Unknown Unknown Unknown
a.out 00000000018D3A37 Unknown Unknown Unknown
a.out 000000000188ADC4 Unknown Unknown Unknown
a.out 000000000188ABD6 Unknown Unknown Unknown
a.out 000000000184BCB9 Unknown Unknown Unknown
a.out 000000000184F410 Unknown Unknown Unknown
libpthread.so.0 00007FBF21C277E0 Unknown Unknown Unknown
a.out 000000000178E634 Unknown Unknown Unknown
a.out 000000000178A423 Unknown Unknown Unknown
a.out 0000000000430491 Unknown Unknown Unknown
a.out 000000000042AACD Unknown Unknown Unknown
a.out 00000000004233D2 Unknown Unknown Unknown
a.out 0000000000422FEA Unknown Unknown Unknown
a.out 0000000000422DD0 Unknown Unknown Unknown
a.out 0000000000422C9E Unknown Unknown Unknown
libc.so.6 00007FBF212DCD1D Unknown Unknown Unknown
a.out 0000000000422B29 Unknown Unknown Unknown
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 00000000018D5C75 Unknown Unknown Unknown
a.out 00000000018D3A37 Unknown Unknown Unknown
a.out 000000000188ADC4 Unknown Unknown Unknown
a.out 000000000188ABD6 Unknown Unknown Unknown
a.out 000000000184BCB9 Unknown Unknown Unknown
a.out 000000000184F410 Unknown Unknown Unknown
libpthread.so.0 00007F8084FD67E0 Unknown Unknown Unknown
a.out 000000000178E634 Unknown Unknown Unknown
a.out 000000000178A423 Unknown Unknown Unknown
a.out 0000000000430491 Unknown Unknown Unknown
a.out 000000000042AACD Unknown Unknown Unknown
a.out 00000000004233D2 Unknown Unknown Unknown
a.out 0000000000422FEA Unknown Unknown Unknown
a.out 0000000000422DD0 Unknown Unknown Unknown
a.out 0000000000422C9E Unknown Unknown Unknown
libc.so.6 00007F808468BD1D Unknown Unknown Unknown
a.out 0000000000422B29 Unknown Unknown Unknown

================================================== =================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= EXIT CODE: 174
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
================================================== =================================

我在我学校的 super 计算机上的 UNIX 系统上运行这段代码,我使用的是英特尔编译器和 MPICH 3.0.1 版。我的实际代码与第二个示例非常相似,它在每个节点上使用了一些 IMSL 子例程。你能帮我让它工作吗?谢谢!

最佳答案

最后,d_1999 提供了 link这给了我足够的信息来解决这个问题。我只需要将链接标志更改为 $LINK_MPIS,然后我就可以毫无问题地运行第二个示例代码。

关于linux - IMSL 和 MPI 之间的冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41458334/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com