并行程序给出错误“对_Kmpc_ok_to_fork的未定义引用"; [英] Parallel program giving error "Undefined reference to _Kmpc_ok_to_fork"

查看:241
本文介绍了并行程序给出错误“对_Kmpc_ok_to_fork的未定义引用";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Linux上编译OPENMP fortran代码.我大约有230个子例程.我用来编译代码的代码如下:1)首先,我使用以下命令编译每个子例程

I am trying to compile the OPENMP fortran code on linux. I have around 230 subroutines. The code I used to compile the code is as follows: 1) At first I compiled each subroutine with the following command

ifort -c -override-limits -openmp *.for

然后,所有子例程现在都有一个单独的目标文件.

Then all the subroutines have now a separate object file.

2)然后,我尝试通过以下命令将目标文件编译为可执行文件

2) Then I tried to compile the object files to the executable by the following command

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中使用链接.

I am using intel 13 composer to compile the program. I didn't know how to use link with libiomp5md .

请帮助我摆脱此错误.我尝试了几次,但无法收到此错误.

Please help me get rid of this error. I tried several times but I couldn't get this error.

如果我不使用openmp标志,则程序会运行,但不会被视为openmp程序.

If I don't use the openmp flag the program runs but it doesn't treat as openmp program.

谢谢

Jdbaba

推荐答案

对英特尔论坛的快速扫描表明,您可能还需要在第二个命令上使用 -openmp 选项,以使它能够链接到OpenMP库.

A quick scan of the Intel forums suggests you may need the -openmp option on the second command as well, to cause it to link against the OpenMP libraries.

您可以通过谷歌搜索 __ kmpc_global_thread_num

这篇关于并行程序给出错误“对_Kmpc_ok_to_fork的未定义引用";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆