Fortran parameter

Discussion of the OpenMP 3.1 draft specifications closed May 1, 2011. (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
FDSUser
Posts: 17
Joined: Sat Nov 15, 2008 8:54 pm

Fortran parameter

Post by FDSUser »

All,

I checked the 3.1 specification (and 3.0) and found no entry that a fortran parameter can not be used within a shared list, if I use a DEFAULT(NONE) clause. Maybe this could be added for clarification, here a short example, which is not possible:

Code: Select all

REAL, PARAMETER :: Y_FU_MIN=2.0

!$OMP PARALLEL DEFAULT(NONE) SHARED(Y_FU_MIN)
If Y_FU_MIN has not the paramter attribute, it will work...
I had this problem and first I didn't know what the compiler tried to tell me, thus I recommend to add this to the Spec for the Shared-clause

Federico

Re: Fortran parameter

Post by Federico »

OpenMP specs clearly state more than once that data-sharing attributes apply only to variables.
Fortran parameters do not match the OpenMP definition of a variable (see Glossary, section 1.2.4), as their values cannot be redefined. Consequently, they are not affected by data-sharing defaults nor allowed on data-sharing clauses.

You can safely remove Y_FU_MIN from the list of shared variables, as it's not needed. Its value will be accessible in the PARALLEL construct, no matter what the DEFAULT() is.

Locked