如果你没有提交给gdb(实际上,它是在mac os作为默认工具链的一部分而被弃用),你可以玩lldb。
所以,像这样的代码:
program main
use mpi
integer error
integer id
integer p
call MPI_Init (error)
call MPI_Comm_size (MPI_COMM_WORLD, p, error)
call MPI_Comm_rank (MPI_COMM_WORLD, id, error)
write (*,*) 'Hello: ', id, '/', p
call MPI_Finalize (error)
stop
end
和编译这样
mpif90 -g -o fort ./fort.f90
,你应该能够启动LLDB以下方式
mpirun -np 2 xterm -e lldb ./fort
,这将给你两个,分别与lldb运行xtermms
请注意,为的xterm,你需要安装XQuartz(https://www.xquartz.org)
更新:
我不知道这是否会与此特定问题上需要帮助,但你总是可以尝试从源代码编译GDB。看看这里说明如何做到这一点:Building GDB on macOS Sierra
然后,您可以使用xterm和gdb和你的MPI这样的代码
mpirun -np 2 xterm -e gdb ./mpi_sample
运行的mpirun现在,你可以看到,仍有与警示dyld版本,但代码似乎工作正常。
但尽管如此,问题是,什么将与ifort编译后的代码发生:(对我来说,我使用:
mpifort --version
GNU Fortran (GCC) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gdb --version
GNU gdb (GDB) 8.0
Copyright (C) 2017 Free Software Foundation, Inc.
mpirun --version
mpirun (Open MPI) 2.0.2
来源
2017-06-30 11:18:40
mko
请告诉你如何编译你的代码*必须*告诉。编译器用'-g'生成调试符号,另外,还有多种不同格式的动态库和调试符号,gdb可能不支持你当前的设置 –
感谢你的回答,我用mpif90 -ggdb test.f90然后我跑了使用mpirun -n 2 ./a.out。 – diex
另外我试了mpif90 -g main.f90 。它没有工作。 – diex