OpenMP private variable initialization
Arjen Markus
arjen.markus895@gmail.com
Thu Mar 28 09:03:00 GMT 2013
Hello Philippe,
the Fortran standard perse does not specify the behaviour for OpenMP -
for that you need to look up the OpenMP specifications. So your question
is caught in a grey area.
However, some experimentation led me to use FIRSTPRIVATE instead of
private. If you use that, it works as you would expect.
FYI, the Intel Fortran compiler gave the same result as the gfortran compiler.
I got error messages on using COPYIN from gfortran. It claims the variable is
not THREADPRIVATE, but using FIRSTPRIVATE results in the same error message.
Regards,
Arjen
2013/3/28 MARGUINAUD Philippe <philippe.marguinaud@meteo.fr>:
> Hi all,
>
> I have a problem with the initialization of a private variable in an
> OpenMP loop. I do not know whether this is really a bug, but I would
> have expected a different behaviour.
>
> $ cat a.F90
> MODULE A
>
> TYPE TA
> INTEGER :: ILMESS = 1024
> END TYPE
>
> END MODULE
> $ cat main.F90
> PROGRAM MAIN
>
> USE A
>
> TYPE (TA) :: YA
>
> PRINT *, YA%ILMESS
>
> !$OMP PARALLEL PRIVATE (YA)
>
> PRINT *, YA%ILMESS
>
> !$OMP END PARALLEL
>
>
> END PROGRAM
>
> $ gfortran -fopenmp a.F90 main.F90 -o main-GNU472.x
> $ ./main-GNU472.x
> 1024
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> ...
>
> What do you think ? Is this a bug or does it conform to the standard ?
>
> Best regards,
>
> Philippe
>
More information about the Fortran
mailing list