OMP:OMP并行DO和OMP DO有什么区别(完全没有并行指令) [英] OMP: What is the difference between OMP PARALLEL DO and OMP DO (Without parallel directive at all)

查看:93
本文介绍了OMP:OMP并行DO和OMP DO有什么区别(完全没有并行指令)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我希望以前没有问过这个问题,因为在搜索中很难找到.

OK, I hope this was not asked before, because this is a little tricky to find on the search.

我看过F95手册,但仍然发现这个模糊的地方:

I have looked over the F95 manual, but still find this vague:

For the simple case of:
DO i=0,99
    <some functionality>
END DO

我正在尝试找出两者之间的区别:

I'm trying to figure out what is the difference between:

!$OMP DO PRIVATE(i)
DO i=0,99
    <some functionality>
END DO
!$OMP END DO

并且:

!$OMP PARALLEL DO PRIVATE(i)
DO i=0,99
    <some functionality>
END DO
!$OMP PARALLEL END DO

(只需指出不同之处:第一个具有OMP DO,但完全没有PARALLEL指令.第二个仅添加了PARALLEL指令)

(Just to point out the difference: the first one has OMP DO but no PARALLEL directive AT ALL. The second just has the PARALLEL directive added)

谢谢!

推荐答案

如果在并行区域之外遇到OpenMP do 指令,则它由一个线程以串行方式执行-行为就像根本没有并行化.当然,那是因为不是.

If the OpenMP do directive is encountered outside a parallel region it is executed in serial by one thread -- it behaves as if it were not parallelised at all. Of course, that's because it isn't.

第一个代码片段没有并行化,第二个是并行化的.

The first of your snippets isn't parallelised, the second is.

我不确定 F95手册是什么意思,也不确定为什么要在那里查找有关OpenMP的信息.

I'm not sure what you mean by the F95 manual nor why you would look there for information about OpenMP.

这篇关于OMP:OMP并行DO和OMP DO有什么区别(完全没有并行指令)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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