Fortran Coder

查看: 7210|回复: 1
打印 上一主题 下一主题

[并行] gfortran编译依赖openmp

[复制链接]

3

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
16 点
跳转到指定楼层
楼主
发表于 2014-8-15 21:28:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我在给几个程序打包,以便部署

源代码在: http://gentoo-pkgs.realtimeweather.info/splib/splib-2.0.2.tar
编译的脚本是: http://gentoo-pkgs.realtimeweather.info/make.sh
配置的环境变量是: export FC="gfortran" ; export FFLAGS="-O2 -pipe -fno-openmp" 或者 export FFLAGS="-O2 -pipe"
(对于-fno-openmp参数的确认参见 http://gcc.gnu.org/ml/gcc/2009-06/msg00013.html

预期结果是:编译得到的 libsp_4.so 等没有 openmp 相关函数
实际结果是:编译得到的库文件包含了 omp_get_num_threads_ 、 omp_get_thread_num_ 两个引用
[Fortran] 纯文本查看 复制代码
     8: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND omp_get_num_threads_
    20: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND omp_get_thread_num_


两个FFLAGS产生的库文件均带有对openmp的引用
此外,http://gentoo-pkgs.realtimeweather.info/splib/splib-1.tar 的代码并不会出现这样的问题

问题:应该如何去除对这两个符号的引用?

gcc版本为:4.7.3

gcc -v 输出如下:
[Shell] 纯文本查看 复制代码
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.7.3-r1/work/gcc-4.7.3/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include/g++-v4 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.3/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.3-r1 p1.4, pie-0.5.5' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --enable-lto --without-cloog --without-ppl
Thread model: posix
gcc version 4.7.3 (Gentoo 4.7.3-r1 p1.4, pie-0.5.5)



分享到:  微信微信
收藏收藏 点赞点赞1 点踩点踩

3

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
16 点
沙发
 楼主| 发表于 2014-8-16 00:27:40 | 只看该作者
grep符号的时候忘了大小写了(以往是C语言的)
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-4-26 01:04

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表