Programming/openMP2013. 11. 26. 19:38
atomic은 atomic 연산이 필요할 경우에 사용하고(읽기+증가+쓰기 3가지 operation을 한번에 하도록)
critical은 블럭에 대해서 다른 부분에서 치고 들어 오지 못하도록 막아준다.

atomic은 하나의 연산에 대한 거라면
critical은 하나의 행위에 대한 거라고 보면 될 듯.

또한 atomic은 rvalue가 없어야 하므로 x++;은 허용하지만 x = x + 1; 은 허용되지 않는다.
(일단 다른 변수와의 합정도는 지원하지만 함수를 부를순 없다. 함수사용시 컴파일 에러가 발생하진 않는다)
The expression statement must have one of the following forms:

xbinop=expr

x++

++x

x--

--x

In the preceding expressions: x is an lvalue expression with scalar type. expr is an expression with scalar type, and it does not reference the object designated by xbinop is not an overloaded operator and is one of +*-/&^|<<, or >>.

[링크 : http://stackoverflow.com/questions/7798010/openmp-atomic-vs-critical

'Programming > openMP' 카테고리의 다른 글

openMP private copyin copyprivate firstprivate lastprivate  (0) 2013.11.28
openMP reduction 절  (0) 2013.11.28
openMP single 과 master의 차이점  (0) 2013.11.26
openMP parallel default  (0) 2013.11.18
openMP gnu implement  (0) 2013.11.11
Posted by 구차니