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

Associate blocks in parallel regions

eos_pengwern
Beginner
401 Views

I've recently been making quite a lot of use of the F2003 'associate block' facility to simply some of my code, for example:

[fortran]

do j=firstrow, lastrow                           

       associate (fb => fbs(j),   lb => lbs(j))

                cos_phi(fb:lb,j) = sqrt(1d0 - sin_phi(fb:lb,j)**2)

       end associate

end do

[/fortran]

 

This works really well, saves a lot of typing, and makes the code a great deal more readable without the overhead of copying into local variables or using pointers.

Until, that is, I try to put the above loop into an OpenMP parallel region, and then it fails with some really exotic errors. The errors go away if I remove the 'associate' structure and give all the variables their full names, so it is definitely the associate block which is causing the problem rather than some other aspect of my parallelization.

Is this intended behaviour, or is it a bug?

 

0 Kudos
1 Reply
eos_pengwern
Beginner
401 Views

I think I've found my answer here. It looks like this is a situation not satisfactorily dealt with by the OpenMP standard, and so for the time being I'll just have to go back to either typing the variable names out in full or using local variables or pointers instead.

0 Kudos
Reply