I've tried to find out what this is in both the Fortran and OpenMP standards, but haven't found anything relevant.
Consider this code fragment:
! 1 - find duplicates !$omp parallel do default(none) & !$omp & shared(lnodes, duplicate_of, nlinks, nnods) & !$omp & private(j, us_node, ds_node) schedule(dynamic) do i = 1, nlinks ! Why not ASSOCIATE? Looks like the associate names get shared in debug builds! us_node = lnodes(link_end_us, i) ds_node = lnodes(link_end_ds, i) if (us_node > nnods .or. ds_node > nnods) cycle ! ignore links to outfalls do j = 1, i - 1 if (lnodes(link_end_us, j) == us_node .and. lnodes(link_end_ds, j) == ds_node) then duplicate_of(i) = j exit else if (lnodes(link_end_ds, j) == us_node .and. lnodes(link_end_us, j) == ds_node) then duplicate_of(i) = -j ! < 0 means reversed orientation exit end if end do end do
The original code had us_node and ds_node defined as associate names in an associate-block, but you can see that I found that these were being shared between loop iterations in recent Intel Fortran versions. My expectation would be that associate-names should be private to an iteration. Also, unsurprisingly, you cannot specify the associate-names in the private clause of the OpenMP do loop, as they aren't declared. Obviously, you can code around this by either having temporary private variables or pointers, but that seems to defeat the object of associate.
Andrew Smith wrote:
I dont believe openMP supports associate names.
Try using a pointer instead.
This was true for older versions of OpenMP, but OpenMP 4.5 and later support most Fortran 2003 features, including associate AFAIK.
Hi, I had the same question:
and there was no clear answer.
The only thing I found is (scroll down):
Further, especially OpenMP + O3 seems to be buggy in current 19.1 (there are some recent threads). My issues with OpenMP in more complex code are partially affected and gone with O2.
I avoid associate in OMP clauses curently. Maybe someone finds a clear statement, whether associate+OMP is allowed AND correctly implement in major compilers.