开发者

Are the indices in an OpenMP loop processed in ascending order?

开发者 https://www.devze.com 2023-03-11 00:24 出处:网络
Consider the following OpenMP for loop: #pragma omp parallel for schedule(dynamic) for (int i = 0; i < n; ++i)

Consider the following OpenMP for loop:

#pragma omp parallel for schedule(dynamic)
for (int i = 0; i < n; ++i)
{
    //do somet开发者_开发知识库hing with i
}

Is it guaranteed that each OpenMP thread sees its i values in ascending order?


The order in which threads run is not guaranteed; the order in which a thread processes its own chunk is guaranteed.


If your question is if each thread will get a chunk of the iteration and if within that chunk the value of i is sequential, then the answer is yes. Is that your question?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号