- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page