- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Will the local data inFortran's pure subroutines ever "cross wires" due to parallel read-modify-write in different threads?
링크가 복사됨
7 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
If you're using /parallel or OpenMP that is coded properly, there should not be a problem. Pure routines really aren't anything special in this regard.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Yes, I have an OMP PARALLEL DO loop. The loop index is used to specify a different element of an array. Only that specific element is passed into the pure subroutine. So all the affected data from outside the pure subroutine is preperly segreated by thread.
The real question is - does the locally declared data in the called subroutine need to have OMP directives to prevent interaction between threads?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
By default,. all variables are "automatic" (stack allocated) when OpenMP is used. So unless you did something that woild force static allocation (SAVE or initialization), nothing should need to be done.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
No. The only thing that forces static allocation for local variables is the SAVE attribute, either explicit or implicit. The only way you get SAVE implicitly is with initialization.
