Fortran pointers and tasking

Discuss the OpenMP 3.0 API Specifications with the OpenMP Arch. Review Board. (Read Only)
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
Locked
Bader@lrz.de
Posts: 2
Joined: Wed Mar 17, 2010 2:15 pm

Fortran pointers and tasking

Post by Bader@lrz.de »

The issue I'm encountering with using OpenMP 3.0 tasks in Fortran is best illustrated by example
A13.3f from the 3.0 specification:

MODULE LIST
TYPE NODE
INTEGER :: PAYLOAD
TYPE (NODE), POINTER :: NEXT
END TYPE NODE
CONTAINS
SUBROUTINE PROCESS(p)
TYPE (NODE), POINTER :: P
! do work here
END SUBROUTINE PROCESS
SUBROUTINE INCREMENT_LIST_ITEMS (HEAD)
TYPE (NODE), POINTER :: HEAD
TYPE (NODE), POINTER :: P
!$OMP PARALLEL PRIVATE(P)
!$OMP SINGLE
P => HEAD
DO
!$OMP TASK
! P is firstprivate by default <---- disallowed by restrictions?
CALL PROCESS(P)
!$OMP END TASK
P => P%NEXT
IF ( .NOT. ASSOCIATED (P) ) EXIT
END DO
!$OMP END SINGLE
!$OMP END PARALLEL
END SUBROUTINE INCREMENT_LIST_ITEMS
END MODULE LIST

This example appears to not conform to the OpenMP rules,
since according to page 94 lines 1-2 Fortran pointers may
not appear in a firstprivate clause; of course I am assuming
this rule also applies for an implicitly acquired firstprivate
attribute (the assumption is based on page 80 line 1-3).

Is this interpretation correct?
If yes, OpenMP tasking appears to be rather crippled in Fortran;
my suspicion is that given proper rules, the cited restriction
on Fortran pointers could be easily dropped (i.e., firstprivate
pointers cause creation of copies which inherit their definition and
association status from the surrounding scope)
If no, what is the exact semantics of Fortran pointers as
used in the above example?

Best Regards
Reinhold Bader

Federico

Re: Fortran pointers and tasking

Post by Federico »

You are right, the issue is well known and its solution is quite obvious (analogous behavior is already supported by copyprivate clause).
The fix is already on the Language Committee list of candidates improvements for the next OpenMP release.

Thanks
Federico

Locked