public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33439]  New: Incorrect error message for chunksize variable
@ 2007-09-14 18:15 longb at cray dot com
  2007-09-17  8:05 ` [Bug fortran/33439] OpenMP: " burnus at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: longb at cray dot com @ 2007-09-14 18:15 UTC (permalink / raw)
  To: gcc-bugs

The GNU compiler is asking that when a default(none)
clause is present on the OMP PARALLEL DO, and a chunk-size expression (in this
case just the variable fsize) appears in a schedule clause, that the variable
must appear in a shared or private clause.  Other compilers (PGI, Pathscale) do
not require that this be done.

I cannot find a justification for requiring that fsize be listed in a
private or shared clause.  It is referenced before the construct begins
execution, but not within the construct itself.  Admittedly, the OpenMP 2.5 
spec is a bit weak on scoping rules in this case, but the text at page 63 lines
25-28 hints to me that a variable that appears in a schedule clause is not
automatically a reference.  The text on page 36 lines 1-19 says that IF the
variable is declared private then the value used is not the private copy but
rather the value of the version external to the construct.  Again this
suggests that the variable in the schedule clause is outside the scope
of the construct.

> gfortran -c -fopenmp test.f90
test.f90: In function 'MAIN__':
test.f90:16: error: 'fsize' not specified in enclosing parallel
test.f90:16: error: enclosing parallel

> cat test.f90
program OMP_program
! derived from ISU's RTED_OpenMP/FORTRAN/SECTION_C/F_C_3_2_a.f90
!                    RTED_OpenMP/FORTRAN/SECTION_C/F_C_3_2_d.f90
  integer, parameter ::  nt=4
  double precision :: s,tmp
  double precision :: ARR(100)
  integer :: fsize,i

  call omp_set_num_threads(nt)
  s = 0.d0
  arr = 1.0d0
  tmp = 4.d0*atan(1.d0)
  fsize = int(sin(-0.25*tmp)*10.0)
  write(*,*) 'tmp, fsize',tmp, fsize

!$omp parallel do  default(none) shared(arr) private(i) reduction(+:s)
schedule(static,fsize)
  do i=1,100
     s = s + arr(i)
  end do
!$omp end parallel do

  print *,'s =', s

end program OMP_program


-- 
           Summary: Incorrect error message for chunksize variable
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: longb at cray dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33439


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-09-21 21:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-14 18:15 [Bug fortran/33439] New: Incorrect error message for chunksize variable longb at cray dot com
2007-09-17  8:05 ` [Bug fortran/33439] OpenMP: " burnus at gcc dot gnu dot org
2007-09-17  8:18 ` jakub at gcc dot gnu dot org
2007-09-17  8:21 ` burnus at gcc dot gnu dot org
2007-09-19 17:31 ` jakub at gcc dot gnu dot org
2007-09-20 16:42 ` jakub at gcc dot gnu dot org
2007-09-21 11:17 ` jakub at gcc dot gnu dot org
2007-10-20  4:09 ` jakub at gcc dot gnu dot org
2009-09-18 18:41 ` geir at cray dot com
2009-09-21 21:31 ` longb at cray dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).