我正在尝试在linux上编译OPENMP fortran代码。我有大约230个子程序。我用来编译代码的代码如下: 1)首先,我使用以下命令编译每个子程序
ifort -c -override-limits -openmp *.for
然后所有子程序现在都有一个单独的目标文件。
2)然后我尝试通过以下命令将目标文件编译为可执行文件
ifort *.o -o myprogram
我收到以下错误:
WINDWAVE.F90:(.text+0x1c9d): undefined reference to `__kmpc_global_thread_num'
WINDWAVE.F90:(.text+0x1cb0): undefined reference to `__kmpc_ok_to_fork'
WINDWAVE.F90:(.text+0x1eea): undefined reference to `__kmpc_fork_call'
WINDWAVE.F90:(.text+0x1f09): undefined reference to `__kmpc_serialized_parallel'
WINDWAVE.F90:(.text+0x214b): undefined reference to `__kmpc_end_serialized_parallel'
WINDWAVE.F90:(.text+0x2427): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0x29c7): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0x29da): undefined reference to `__kmpc_barrier'
WINDWAVE.F90:(.text+0x2a50): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0x3773): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0x3786): undefined reference to `__kmpc_barrier'
WINDWAVE.F90:(.text+0x37fc): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0x4a58): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0x4a6b): undefined reference to `__kmpc_barrier'
WINDWAVE.F90:(.text+0x4a8f): undefined reference to `__kmpc_single'
WINDWAVE.F90:(.text+0x4d18): undefined reference to `__kmpc_end_single'
WINDWAVE.F90:(.text+0x4d2b): undefined reference to `__kmpc_barrier'
WINDWAVE.F90:(.text+0x4da9): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0x4fc5): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0x4fd8): undefined reference to `__kmpc_barrier'
WINDWAVE.F90:(.text+0x504e): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0x596f): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0x5982): undefined reference to `__kmpc_barrier'
WINDWAVE.F90:(.text+0x59fb): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0x6369): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0x637c): undefined reference to `__kmpc_barrier'
WINDWAVE.F90:(.text+0x63f2): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0x6b8d): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0x6ba0): undefined reference to `__kmpc_barrier'
WINDWAVE.o: In function `windwave_mp_fetch_':
WINDWAVE.F90:(.text+0x9cfd): undefined reference to `__kmpc_global_thread_num'
WINDWAVE.F90:(.text+0x9d10): undefined reference to `__kmpc_ok_to_fork'
WINDWAVE.F90:(.text+0x9da0): undefined reference to `__kmpc_fork_call'
WINDWAVE.F90:(.text+0x9dbc): undefined reference to `__kmpc_serialized_parallel'
WINDWAVE.F90:(.text+0x9e59): undefined reference to `__kmpc_end_serialized_parallel'
WINDWAVE.F90:(.text+0xa0ea): undefined reference to `__kmpc_for_static_init_4'
WINDWAVE.F90:(.text+0xa109): undefined reference to `__kmpc_for_static_fini'
WINDWAVE.F90:(.text+0xa118): undefined reference to `__kmpc_barrier'
我正在使用intel 13 composer来编译程序。我不知道如何使用与libiomp5md的链接。
请帮我摆脱这个错误。我试了几次,但我不能得到这个错误。
如果我不使用openmp标志,程序会运行,但它不会被视为openmp程序。
谢谢
Jdbaba
答案 0 :(得分:6)
对英特尔论坛的快速扫描表明,您可能还需要第二个命令上的-openmp
选项,以使其链接到OpenMP库。
您可以通过Google搜索__kmpc_global_thread_num
答案 1 :(得分:0)
我遇到了同样的问题,经过搜索后,有人提出了这种方法,对我有用。只需在调用ifort时添加此选项:
-openmp -fpp -auto
该问题可能是由于未链接到mp库引起的。