Are the indices in an OpenMP loop processed in ascending order?
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?
精彩评论