在编译器选项中禁用OpenMP会产生大量的引用错误

时间:2017-04-13 21:49:35

标签: c openmp icc

我在C中有一个项目,我需要以并行和顺序模式测量程序性能。

程序与openmp并行化。

如果我用-openmp标志编译我的程序,一切都很好。

但如果我用-openmp-stubs替换-openmp,我会得到大量的引用错误:

ccc.c:614: undefined reference to `__kmpc_for_static_init_4'
ccc.c:614: undefined reference to `__kmpc_for_static_fini'
ccc.c:624: undefined reference to `__kmpc_barrier'
build/liblcthw.a(ccc.o): In function `deusv2v_dbg':
ccc.c:632: undefined reference to `__kmpc_global_thread_num'
ccc.c:632: undefined reference to `__kmpc_ok_to_fork'
ccc.c:632: undefined reference to `__kmpc_fork_call'
ccc.c:632: undefined reference to `__kmpc_serialized_parallel'
ccc.c:632: undefined reference to `__kmpc_end_serialized_parallel'
build/liblcthw.a(ccc.o): In function `L_deusv2v_dbg_632__par_region0_2_862':
ccc.c:636: undefined reference to `__kmpc_for_static_init_4'
ccc.c:636: undefined reference to `__kmpc_for_static_fini'
ccc.c:646: undefined reference to `__kmpc_barrier'
build/liblcthw.a(ccc.o): In function `seusv2v_dbg':
ccc.c:654: undefined reference to `__kmpc_global_thread_num'
ccc.c:654: undefined reference to `__kmpc_ok_to_fork'
ccc.c:654: undefined reference to `__kmpc_fork_call'
ccc.c:654: undefined reference to `__kmpc_serialized_parallel'
ccc.c:654: undefined reference to `__kmpc_end_serialized_parallel'
build/liblcthw.a(ccc.o): In function `L_seusv2v_dbg_654__par_region0_2_954':
ccc.c:658: undefined reference to `__kmpc_for_static_init_4'
ccc.c:658: undefined reference to `__kmpc_for_static_fini'
ccc.c:668: undefined reference to `__kmpc_barrier'

编译器:icc版本13.1.3(gcc版本4.4.6兼容性)

我做错了什么?是否有可能以其他方式临时禁用openmp?

我使用omp_get_wtime来衡量性能时间,因此我根本无法禁用OpenMP。

0 个答案:

没有答案