Fortran pointers and tasking

Discuss the OpenMP 3.0 API Specifications with the OpenMP Arch. Review Board. (Read Only)

Fortran pointers and tasking

Postby Bader@lrz.de » Wed Mar 17, 2010 2:54 pm

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
Bader@lrz.de
 
Posts: 2
Joined: Wed Mar 17, 2010 2:15 pm

Re: Fortran pointers and tasking

Postby Federico » Thu Mar 18, 2010 6:23 am

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
Federico
 
Posts: 22
Joined: Wed Oct 24, 2007 6:39 am


Return to OpenMP 3.0 API Specifications

Who is online

Users browsing this forum: No registered users and 1 guest

cron