[Omp] PARALLEL DO REDUCTION of array-valued variables?
Hoeflinger, Jay P
jay.p.hoeflinger at intel.com
Mon Oct 30 07:57:37 PST 2006
This is not a valid Fortran program. You have declared the function to
have an array-valued return value, but then use the function name (func)
as a scalar inside the function. The function doesn't define an array
to return. Also, no value is assigned to n, so you have no guarantee on
the number of iterations for the DO loop.
If you replace the
INTEGER, DIMENSION(n) :: func
with
INTEGER :: func
(and assign a value to n) the program runs correctly, with and without
OpenMP, with the Intel compiler.
Jay
-----Original Message-----
From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf
Of Daniel Franke
Sent: Saturday, October 28, 2006 4:21 PM
To: omp at openmp.org
Subject: [Omp] PARALLEL DO REDUCTION of array-valued variables?
Hi all.
The code below crashes GNU as well as INTEL fortran compilers.
If either "func" is not array valued or not listed in the REDUCE-clause,
everything is fine (at least, from the compiler's point of view).
$> cat omp.f90
PROGRAM omp
write (*,*) func(n)
CONTAINS
FUNCTION func(n)
INTEGER, INTENT(in) :: n
INTEGER, DIMENSION(n) :: func
INTEGER :: k
func = 0
!$OMP PARALLEL DO PRIVATE(k), REDUCTION(+:func)
DO k = 1, n
func = func + 1
END DO
!$OMP END PARALLEL DO
END FUNCTION
END PROGRAM
Could someone be so kind to comment on what is wrong?
Thanks
Daniel
P.S. Detailed reports of compiler crahes:
gfortran: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29629
ifort: If someone from INTEL reads this, where is one supposed to report
ICEs?
_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp
More information about the Omp
mailing list