码迷,mamicode.com
首页 > 其他好文 > 详细

OMP笔记(1)

时间:2014-06-01 13:05:15      阅读:309      评论:0      收藏:0      [点我收藏+]

标签:c   style   class   code   a   tar   

Difference between static and dynamic schedule in openMP in C


Using OMP_SCHEDULE with #pragma omp for parallel schedule(runtime)

C OpenMP - Enforce default chunk size

OpenMP: for schedule(vip)

I think you have difficulty with the English meaning of schedule. It refers to the way the work, i.e. the individual values of the loop variable, is spread across the threads. static means that it is decided at the beginning which thread will do which values, where as dynamic means that each thread will work on a chunk of values and then take the next chunk which hasn‘t been worked on by any thread. The latter allows better balancing (in case the work varies between different values for the loop variable), but requires some communication overhead. –  Walter Jun 1 ‘12 at 12:54


P.S. If local variables are automatically private, what is the point of using private clause?

The point is presumably that in earlier versions of C you needed to declare all variables at the beginning of the function, and this is still the prevailing style.

That is, code such as this:

#pragma omp parallel
{
    int x;
}

is the preferred way in C++. But in some versions of C you cannot use this code, you need to use the private clause.

https://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/optaps/common/optaps_par_mpex.htm

OMP笔记(1),布布扣,bubuko.com

OMP笔记(1)

标签:c   style   class   code   a   tar   

原文地址:http://blog.csdn.net/mathgeophysics/article/details/27955621

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!