public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32468]  New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4
@ 2007-06-22 19:56 longb at cray dot com
  2007-06-22 21:37 ` [Bug fortran/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS dfranke at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: longb at cray dot com @ 2007-06-22 19:56 UTC (permalink / raw)
  To: gcc-bugs

Description:
This test case exhibits the problem that the presence of a SECTIONS directive
with only one SECTION inside of a PARALLEL region causes only one thread to be
created when omp_set_num_threads was previously called with 4 threads.  If
the directives internal to this PARALLEL region are commented out, 4 threads
are created and the program produces expected output.  The compiler used
was GNU gfortran.  The test case works as expected when compiled with PGI.

> gfortran -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../xt-gcc-4.2.0/configure --prefix=/opt/gcc/4.2.0/snos
--disable-nls --libdir=/opt/gcc/4.2.0/snos/lib --enable-languages=c,c++,fortran
--with-gxx-include-dir=/opt/gcc/4.2.0/snos/include/g++
--with-slibdir=/opt/gcc/4.2.0/snos/lib --with-system-zlib --enable-shared
--enable-__cxa_atexit x86_64-suse-linux
Thread model: posix
gcc version 4.2.0 20070514 (rpm:4)


> cat bug2831.f90
! Derived from OpenMP test omp1/F2_1_1_2_1c.f90
      use omp_lib
      implicit none
      integer, parameter :: NT = 4
      integer :: nth

!$    call omp_set_dynamic(.false.)
!$    call omp_set_num_threads(NT)
!$omp parallel default(none) shared(nth)
      print *, omp_get_thread_num(), omp_get_num_threads()
!$omp sections
!$omp section
      nth=omp_get_num_threads()
!$omp endsections
!$omp endparallel

      print *, 'nth=',nth,'  NT=',NT
      END

> diff bug2831.f90 bug2831a.f90
11,12d10
< !$omp sections
< !$omp section
14d11
< !$omp endsections

Incorrect output is produced:

> ftn -O0 -fopenmp -o x bug2831.f90
/opt/xt-pe/2.1/bin/snos64/ftn: INFO: linux target is being used
> aprun -n 1 ./x
           0           1
 nth=           1   NT=           4
Application 217361 resources: utime 0, stime 0

Correct output from program with sections/section directives removed:

> ftn -O0 -fopenmp -o xa bug2831a.f90
/opt/xt-pe/2.1/bin/snos64/ftn: INFO: linux target is being used
> aprun -n 1 ./xa
           0           4
           1           4
           3           4
           2           4
 nth=           4   NT=           4
Application 217362 resources: utime 0, stime 0


------
Note: ftn is an alias for:

/opt/gcc/4.2.0/bin/../snos/bin/gfortran -static -v
-I/opt/xt-mpt/2.1/mpich2-64/GP/include -I/opt/xt-mpt/2.1/mpich2-64/GP/include
-L/opt/xt-mpt/2.1/mpich2-64/GP/lib -I/opt/acml/3.6.1/gnu64/include
-I/opt/xt-libsci/10.1.0/gnu/snos64/include
-I/opt/xt-libsci/10.1.0/gnu/snos64/include/superlu
-I/opt/xt-mpt/2.1/sma/P/include -L/opt/acml/3.6.1/gnu64/lib
-L/opt/xt-libsci/10.1.0/gnu/snos64/lib -L/opt/xt-mpt/2.1/sma/P/lib -lmpichf90
-lsci -lacml -lsma -lmpichf90 -lmpich -lrt -D__CRAYXT_COMPUTE_LINUX_TARGET
-D__TARGET_LINUX__ -fno-second-underscore
-I/notbackedup/users/rsrel/rs64.DEV.070604.Mon/install/include
-I/opt/xt-catamount/2.1/catamount/linux/include -I/opt/xt-service/2.1/include
-L/notbackedup/users/rsrel/rs64.DEV.070604.Mon/install/lib/snos64
-L/opt/xt-pe/2.1/cnos/linux/64/lib -L/opt/xt-mpt/2.1/lib/snos64
-L/opt/xt-service/2.1/lib/snos64 -Wl,--start -lpct -lalpslli -lalpsutil
-lportals -lpthread -Wl,--end -lgfortranbegin -lgfortran -lm


-- 
           Summary: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION
                    TO HAVE 1 THREAD, NOT 4
           Product: gcc
           Version: 4.2.0
            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=32468


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

* [Bug fortran/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
@ 2007-06-22 21:37 ` dfranke at gcc dot gnu dot org
  2007-06-22 21:54 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-22 21:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dfranke at gcc dot gnu dot org  2007-06-22 21:37 -------
Toying with the example shows that the number of threads in the parallel region
always equals the minimum of the number of SECTIONs or the MAX_NUM_THREADS.
I.e. adding another SECTION will create two threads, having 5 sections will
result in 4 threads as NT==4. 

This is true for both, 4.2 and latest svn (20070622).

Adding Jakub as CC.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org, jakub at gcc dot gnu
                   |                            |dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|x86_64-suse-linux           |
   GCC host triplet|x86_64-suse-linux           |
 GCC target triplet|x86_64-suse-linux           |
           Keywords|                            |openmp
      Known to fail|                            |4.2.1 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-22 21:37:31
               date|                            |
            Summary|PRESENCE OF SECTIONS W/ 1   |number of threads in a
                   |SECTION CAUSES PARALLEL     |parallel region depends on
                   |REGION TO HAVE 1 THREAD, NOT|number of SECTIONs and
                   |4                           |MAX_THREADS


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


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

* [Bug fortran/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
  2007-06-22 21:37 ` [Bug fortran/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS dfranke at gcc dot gnu dot org
@ 2007-06-22 21:54 ` jakub at gcc dot gnu dot org
  2007-07-02 12:20 ` [Bug libgomp/32468] " jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-06-22 21:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-06-22 21:54 -------
There are several issues, will fix them on Monday.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-06-22 21:37:31         |2007-06-22 21:54:00
               date|                            |


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


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

* [Bug libgomp/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
  2007-06-22 21:37 ` [Bug fortran/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS dfranke at gcc dot gnu dot org
  2007-06-22 21:54 ` jakub at gcc dot gnu dot org
@ 2007-07-02 12:20 ` jakub at gcc dot gnu dot org
  2007-07-02 19:19 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 12:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2007-07-02 12:20 -------
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01867.html
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01875.html


-- 


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


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

* [Bug libgomp/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
                   ` (2 preceding siblings ...)
  2007-07-02 12:20 ` [Bug libgomp/32468] " jakub at gcc dot gnu dot org
@ 2007-07-02 19:19 ` jakub at gcc dot gnu dot org
  2007-07-02 19:23 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 19:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-07-02 19:19 -------
Subject: Bug 32468

Author: jakub
Date: Mon Jul  2 19:19:28 2007
New Revision: 126224

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126224
Log:
        PR libgomp/32468
        * sections.c (GOMP_parallel_sections_start): Only decrease
        number of threads to COUNT if dyn_var is true.
        * testsuite/libgomp.c/pr32468.c: New test.

Added:
    trunk/libgomp/testsuite/libgomp.c/pr32468.c
Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/sections.c


-- 


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


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

* [Bug libgomp/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
                   ` (3 preceding siblings ...)
  2007-07-02 19:19 ` jakub at gcc dot gnu dot org
@ 2007-07-02 19:23 ` jakub at gcc dot gnu dot org
  2007-07-02 19:26 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 19:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2007-07-02 19:22 -------
Subject: Bug 32468

Author: jakub
Date: Mon Jul  2 19:22:47 2007
New Revision: 126226

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126226
Log:
        PR libgomp/32468
        * omp-low.c (check_combined_parallel): New function.
        (lower_omp_parallel): Call it via walk_stmts, set
        OMP_PARALLEL_COMBINED if appropriate.
        (determine_parallel_type): If OMP_FOR resp. OMP_SECTIONS
        isn't the only statement in WS_ENTRY_BB or OMP_RETURN
        the only one in PAR_EXIT_BB and not OMP_PARALLEL_COMBINED,
        don't consider it as combined parallel.

        * gcc.dg/gomp/pr32468-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/gomp/pr32468-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/omp-low.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug libgomp/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
                   ` (4 preceding siblings ...)
  2007-07-02 19:23 ` jakub at gcc dot gnu dot org
@ 2007-07-02 19:26 ` jakub at gcc dot gnu dot org
  2007-07-02 19:27 ` jakub at gcc dot gnu dot org
  2007-07-02 19:28 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 19:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2007-07-02 19:26 -------
Subject: Bug 32468

Author: jakub
Date: Mon Jul  2 19:26:25 2007
New Revision: 126227

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126227
Log:
        PR libgomp/32468
        * sections.c (GOMP_parallel_sections_start): Only decrease
        number of threads to COUNT if dyn_var is true.
        * testsuite/libgomp.c/pr32468.c: New test.

Added:
    branches/gcc-4_2-branch/libgomp/testsuite/libgomp.c/pr32468.c
Modified:
    branches/gcc-4_2-branch/libgomp/ChangeLog
    branches/gcc-4_2-branch/libgomp/sections.c


-- 


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


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

* [Bug libgomp/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
                   ` (5 preceding siblings ...)
  2007-07-02 19:26 ` jakub at gcc dot gnu dot org
@ 2007-07-02 19:27 ` jakub at gcc dot gnu dot org
  2007-07-02 19:28 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 19:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2007-07-02 19:27 -------
Subject: Bug 32468

Author: jakub
Date: Mon Jul  2 19:27:28 2007
New Revision: 126228

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126228
Log:
        PR libgomp/32468
        * omp-low.c (check_combined_parallel): New function.
        (lower_omp_parallel): Call it via walk_stmts, set
        OMP_PARALLEL_COMBINED if appropriate.
        (determine_parallel_type): If OMP_FOR resp. OMP_SECTIONS
        isn't the only statement in WS_ENTRY_BB or OMP_RETURN
        the only one in PAR_EXIT_BB and not OMP_PARALLEL_COMBINED,
        don't consider it as combined parallel.

        * gcc.dg/gomp/pr32468-1.c: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/gcc.dg/gomp/pr32468-1.c
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/omp-low.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug libgomp/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS
  2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
                   ` (6 preceding siblings ...)
  2007-07-02 19:27 ` jakub at gcc dot gnu dot org
@ 2007-07-02 19:28 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 19:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2007-07-02 19:28 -------
Fixed in SVN.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-07-02 19:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-22 19:56 [Bug fortran/32468] New: PRESENCE OF SECTIONS W/ 1 SECTION CAUSES PARALLEL REGION TO HAVE 1 THREAD, NOT 4 longb at cray dot com
2007-06-22 21:37 ` [Bug fortran/32468] number of threads in a parallel region depends on number of SECTIONs and MAX_THREADS dfranke at gcc dot gnu dot org
2007-06-22 21:54 ` jakub at gcc dot gnu dot org
2007-07-02 12:20 ` [Bug libgomp/32468] " jakub at gcc dot gnu dot org
2007-07-02 19:19 ` jakub at gcc dot gnu dot org
2007-07-02 19:23 ` jakub at gcc dot gnu dot org
2007-07-02 19:26 ` jakub at gcc dot gnu dot org
2007-07-02 19:27 ` jakub at gcc dot gnu dot org
2007-07-02 19:28 ` jakub at gcc dot gnu dot org

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