Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29243 Discussions

Question about thread save subroutines for OpenMP

guangye_li
Beginner
446 Views
Hi, I am a customer at Shell. I am writing a code using Fotran with OpenMP and ifort. To have high level parallelizm, each thread needs to call a subroutine to work on its own private column. After the the subroutine is done, I made sure that all threads return correct results. But after "!$omp end parallel", the values become all zeros. Does the Intel ifort compiler support thread-save? How should I do it?
Thanks.
Guangye Li
0 Kudos
3 Replies
roddur
Beginner
446 Views
ifort do support threading and openmp.
what result do you get when you run with OMP_NUM_THREADS=1?
0 Kudos
TimP
Honored Contributor III
446 Views
Quoting - guangye.li
after "!$omp end parallel", the values become all zeros. Does the Intel ifort compiler support thread-save? How should I do it?

Do you mean lastprivate?
0 Kudos
jimdempseyatthecove
Honored Contributor III
446 Views
Quoting - guangye.li
Hi, I am a customer at Shell. I am writing a code using Fotran with OpenMP and ifort. To have high level parallelizm, each thread needs to call a subroutine to work on its own private column. After the the subroutine is done, I made sure that all threads return correct results. But after "!$omp end parallel", the values become all zeros. Does the Intel ifort compiler support thread-save? How should I do it?
Thanks.
Guangye Li

Please supply a sampe of your code (or mock-up of code).

This sounds like a case where each thread works independently on a column of a application-wide array .AND. you are declaring that column private in the !$omp paralllel statement when it (the entire array)needs to be declared shared (but where each thread works on seperate columns).

Jim Dempsey
0 Kudos
Reply