openMP的编译过程

Daneill 2010-11-24 07:48:01
请教openMP和MPI的编译过程,听说他们是生成c+pthread程序,请高手指教!越详细越好
万分感谢!
...全文
509 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
intel_iclifort 2011-02-18
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 mht_luhy 的回复:]

另借贴问openmp边读边处理,程序性能反而差,是什么原因?
[/Quote]

I/O操作是无法分割并行的。如果可能的话,使用boss-worker的方法解决
mht_luhy 2011-01-18
  • 打赏
  • 举报
回复
同求ppt,hylu@ncgr.ac.cn
谢谢!
另借贴问openmp边读边处理,程序性能反而差,是什么原因?
ayang008 2011-01-05
  • 打赏
  • 举报
回复
同求PPT,ayang008kkk@163.com
不胜感激~
Daneill 2010-12-22
  • 打赏
  • 举报
回复
好,谢谢xunxun1982,非常感激!
xunxun 2010-12-21
  • 打赏
  • 举报
回复
……晕,还是看不懂你的问题。
gcc的openmp底层是调用pthread库的,你只需要使用openmp封装即可,pthread的特征已经隐藏掉了……

我不知道你说的pthread程序是什么,你写完openmp代码后,gcc会自行编译成pthread的接口,这一块你是不需要管的。其实你使用nm test.o看符号的话,openmp的代码已经完全解释成pthread的函数了。
Daneill 2010-12-21
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 xunxun1982 的回复:]
引用 9 楼 daneill 的回复:

引用 7 楼 xunxun1982 的回复:
引用 5 楼 daneill 的回复:

gcc -fopenmp -c test.c生成的是.o文件

我的test.c使用openmp写的,我得到openmp程序装换成pthread程序之后的pthread程序文件


谢谢 xunxun1982

没看懂什么意思


请问:编……
[/Quote]

openmp一定是生成某种程序,然后这种程序能调用pthread库,我想知道这种程序是pthread程序吗?怎么才能看到这种程序呢?
xunxun 2010-12-21
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 daneill 的回复:]

引用 7 楼 xunxun1982 的回复:
引用 5 楼 daneill 的回复:

gcc -fopenmp -c test.c生成的是.o文件

我的test.c使用openmp写的,我得到openmp程序装换成pthread程序之后的pthread程序文件


谢谢 xunxun1982

没看懂什么意思


请问:编译过程中,openMP程序是先生成C/C++……
[/Quote]

gcc的openmp底层是链接的pthreads库的,用openmp的过程中,关于pthreads的东西不用去管,编译完直接运行即可。

使用gcc -fopenmp test.c -o test 即可

我前面的意思是,如果你使用IDE或者makefile,一般情形下编译和链接是分开的,
那么就
gcc -fopenmp -c test.c
gcc -fopenmp test.o -o test
Daneill 2010-12-21
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 xunxun1982 的回复:]
引用 5 楼 daneill 的回复:

gcc -fopenmp -c test.c生成的是.o文件

我的test.c使用openmp写的,我得到openmp程序装换成pthread程序之后的pthread程序文件


谢谢 xunxun1982

没看懂什么意思
[/Quote]

请问:编译过程中,openMP程序是先生成C/C++ + pthread程序吗?如果是,如何看openMP程序生成的C/C++ + pthread程序?

多谢xunxun1982 感激万分!!!!
Daneill 2010-12-21
  • 打赏
  • 举报
回复
我的邮箱是jasper8717@gmail.com

谢谢hw_henry2008
xunxun 2010-12-12
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 daneill 的回复:]

gcc -fopenmp -c test.c生成的是.o文件

我的test.c使用openmp写的,我得到openmp程序装换成pthread程序之后的pthread程序文件


谢谢 xunxun1982
[/Quote]
没看懂什么意思
hw_henry2008 2010-12-12
  • 打赏
  • 举报
回复
给我你的邮箱,给你点PPT看看吧
OpenMP is a set of extensions to Fortran/C/C++
OpenMP contains compiler directives, library routines and environment variables.
Available on most single address space machines.
shared memory systems, including cc-NUMA
Chip MultiThreading: Chip MultiProcessing (Sun UltraSPARC IV), Simultaneous Multithreading (Intel Xeon)
not on distributed memory systems, classic MPPs, or PC clusters (yet!)
Daneill 2010-12-12
  • 打赏
  • 举报
回复
gcc -fopenmp -c test.c生成的是.o文件

我的test.c使用openmp写的,我得到openmp程序装换成pthread程序之后的pthread程序文件


谢谢 xunxun1982
Daneill 2010-11-29
  • 打赏
  • 举报
回复
跟编译器、os还有关系啊?

哦,我使用的是gcc,ubuntu9.10

是指pthread库

请教:openMP和MPI的编译过程??

万分感激!!!
xunxun 2010-11-29
  • 打赏
  • 举报
回复
openmp编译:
一步的话只需要 gcc -fopenmp test.c 或 g++ -fopenmp test.cpp
编译链接分开的话:先编译 gcc -fopenmp -c test.c
再链接 gcc -o test test.o -lgomp -lpthread

mpi很多啊,你用的什么
openmpi?mpich1/2?
xunxun 2010-11-28
  • 打赏
  • 举报
回复
不知道你使用什么编译器、操作系统、系统环境?
c+pthread是什么意思?是指pthread库么?
Daneill 2010-11-27
  • 打赏
  • 举报
回复
咋没人回答呢?期待中。。。。。跪求高手指点啊!!!!!!!!!!!!!!

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧