Intel compiler V11 and OpenMP - problem

jimdempseyatthecove
Total Points:
34,847
Status Points:
34,847
Black Belt
November 22, 2008 5:26 PM PST
Rate
 
#7 Reply to #5

>>The Z_VECTOR variable is correctly allocated in another module,

Then Z_VECTOR cannot be private (unless it is also automatic)

Whats happening is your Z_VECTOR is being allocated in another module. i.e. The array descriptor for Z_VECTOR resides in the other module, and the allocation of Z_VECTOR data initializes the array descriptor of foo::Z_VECTOR. By making Z_VECTOR and OpenMP PRIVATE variable you are instantiating an uninitialized array descriptor of the name Z_VECTOR in the scope of the thread and within the context of the openmp parallel region. When compiling without OpenMP (and without the private) you will be using the modules copy of Z_VECTOR.

If each thread needs a seperate copy of Z_VECTOR and if you cannot stack allocate or you do not desire the overhead of allocation/deallocation as you enter and leave the parallel region then either place Z_VECTOR into thread private data or generate the approprate Z_VECTOR reference for passing to the subroutine. e.g. use pointer to array of Z_VECTORs indexed by a thread unique sequence number. Note, when you use OpenMP nested parallelization you cannot use omp_thread_num() to obtain a unique thread number (generate your own and place it into thread private data).

Jim Dempsey

 



Intel Software Network Forums Statistics

8290 users have contributed to 31236 threads and 99110 posts to date.
In the past 24 hours, we have 8 new thread(s) 23 new posts(s), and 32 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing...  Escalated as

Please welcome our newest member zq.x