OpenMP parallel for-什么是默认计划? [英] OpenMP parallel for - what is default schedule?
问题描述
未指定schedule
子句时使用什么调度算法?即:
What schedule algorithm is used when no schedule
clause is specified? I.e.:
#pragma omp parallel for
for (int i = 0; i < n; ++i)
Foo(i);
推荐答案
从文档. 2.7.1.1确定工作共享循环的时间表如下:
如果loop指令没有 schedule 子句,则 def-sched-var ICV的当前值将确定时间表.
If the loop directive does not have a schedule clause then the current value of the def-sched-var ICV determines the schedule.
引号前的句子引用第2.3.1节,内容为:
The sentence preceding the quoted one refers to Section 2.3.1 which reads:
- def-sched-var -控制实现定义的循环区域默认调度.每个设备都有一份该ICV副本.
- def-sched-var - controls the implementation defined default scheduling of loop regions. There is one copy of this ICV per device.
2.3.2 ICV初始化部分中的表指出, def-sched-var 的初始值是实现定义的,并且没有任何环境变量会影响该实现.价值.因此,默认的循环时间表是由实现定义的. Q.E.D.
The table in Section 2.3.2 ICV Initialization states that the initial value of def-sched-var is implementation defined and that there is no environment variable that affects that value. Therefore the default loop schedule is implementation defined. Q.E.D.
这篇关于OpenMP parallel for-什么是默认计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!