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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  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 ` burnus at gcc dot gnu dot org
  2007-09-17  8:18 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-09-17  8:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-09-17 08:05 -------
Jakub, do you agree that this is a bug or is this no bug?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu dot org


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  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
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-17  8:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-09-17 08:18 -------
Pedantically this is not a bug.  If an omp sentinel doesn't have the desired
form, it should be handled as a normal comment.  As the preceeding line
doesn't end with &, then !$omp& is not a valid omp sentinel (as !$omp needs to
be followed by a space) and thus it is the same as say
! $ omp & something
That said, perhaps we could issue some diagnostics, because it is likely
a user error rather than intent.


-- 


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-09-17  8:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-09-17 08:21 -------
> Pedantically this is not a bug.  If an omp sentinel doesn't have the desired
> form, it should be handled as a normal comment.

I think your comment is with regards to PR 33445 and not regarding this PR
(PR33439).


-- 


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  2007-09-14 18:15 [Bug fortran/33439] New: Incorrect error message for chunksize variable longb at cray dot com
                   ` (2 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-19 17:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-09-19 17:30 -------
I think the standard is very vague here.
First consider:
!$omp parallel default(none)
  call something
!$omp do schedule(static, chunksize)
  do i=1,100
    call somethingelse
  done
!$omp end do
!$omp end parallel

Do you agree that this must issue an error?  Here page 36 only says that
if there was say !$omp do schedule(static, chunksize) private(chunksize), then
schedule would use the outer chunksize, while inside of the loop would be a
different, privatized, variable.  I can't see how chunksize wouldn't count here
as a reference of that variable inside of the parallel.

Now, consider:
!$omp parallel default(none)
!$omp do schedule(static, chunksize)
  do i=1,100
    call somethingelse
  done
!$omp end do
!$omp end parallel

I believe this falls to the same category as the previous one.
Now, for the combined parallel it is very unclear, but doesn't section 2.6
say they have the same semantics as the above?


-- 


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  2007-09-14 18:15 [Bug fortran/33439] New: Incorrect error message for chunksize variable longb at cray dot com
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-20 16:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2007-09-20 16:42 -------
http://openmp.org/pipermail/omp/2007/001067.html


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  2007-09-14 18:15 [Bug fortran/33439] New: Incorrect error message for chunksize variable longb at cray dot com
                   ` (4 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-21 11:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2007-09-21 11:17 -------
Subject: Bug 33439

Author: jakub
Date: Fri Sep 21 11:17:13 2007
New Revision: 128649

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128649
Log:
        PR fortran/33439
        * gfortran.dg/gomp/pr33439.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/gomp/pr33439.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  2007-09-14 18:15 [Bug fortran/33439] New: Incorrect error message for chunksize variable longb at cray dot com
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-10-20  4:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2007-10-20 04:08 -------
*** Bug 33718 has been marked as a duplicate of this bug. ***


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |geir at cray dot com


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  2007-09-14 18:15 [Bug fortran/33439] New: Incorrect error message for chunksize variable longb at cray dot com
                   ` (6 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: geir at cray dot com @ 2009-09-18 18:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from geir at cray dot com  2009-09-18 18:41 -------
Here is how other compilers process this code:

PGI:

$ pgf90 -mp test.f90
$ ./a.out
Warning: omp_set_num_threads (4) greater than available cpus (2)
 tmp, fsize    3.141592653589793                -7
 s =    0.000000000000000
$ pgf90 test.f90
$ ./a.out
 tmp, fsize    3.141592653589793                -7
 s =    100.0000000000000
$

Intel:

$ ifort -openmp test.f90
$ ./a.out
 tmp, fsize   3.14159265358979               -7
 s =   100.000000000000
$ ifort test.f90
/tmp/pbs.1871075.sdb/ifortE1EQWX.o: In function `MAIN__':
test.f90:(.text+0x3e): undefined reference to `omp_set_num_threads_'
$

Cray:

$ ftn -target=native -Oomp test.f90
/opt/cray/xt-asyncpe/3.3/bin/ftn: INFO: native target is being used
$ ./a.out
 tmp, fsize 3.1415926535897931,  -7
 s = 0.
$ ftn -target=native -Onoomp test.f90
/opt/cray/xt-asyncpe/3.3/bin/ftn: INFO: native target is being used
$ ./a.out
 tmp, fsize 3.1415926535897931,  -7
 s = 100.
$

I would say that none of the above are desired behavior, but rather a runtime
error message should be printed out.


-- 


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


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

* [Bug fortran/33439] OpenMP: Incorrect error message for chunksize variable
  2007-09-14 18:15 [Bug fortran/33439] New: Incorrect error message for chunksize variable longb at cray dot com
                   ` (7 preceding siblings ...)
  2009-09-18 18:41 ` geir at cray dot com
@ 2009-09-21 21:31 ` longb at cray dot com
  8 siblings, 0 replies; 10+ messages in thread
From: longb at cray dot com @ 2009-09-21 21:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from longb at cray dot com  2009-09-21 21:31 -------
The OpenMP spec does require (requirement is on the user):

"chunk_size must be a loop invariant integer expression with a positive value",

so detection of a chunk size of -7 at run time would be a user-friendly thing
to do. 


-- 


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).