public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32551] New: INCORRECT OUTPUT OBTAINED FROM NESTED PARALLELISM THAT IS SERIALIZED
@ 2007-06-29 18:58 longb at cray dot com
2007-06-29 21:28 ` [Bug fortran/32551] incorrect output obtained from nested parallelism that is serialized dfranke at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: longb at cray dot com @ 2007-06-29 18:58 UTC (permalink / raw)
To: gcc-bugs
Description:
This test case tries to show that
the following statement found in the OpenMP API Version 2.5 May 2005 on p.29
lines 21-24 is true:
"When a thread executing inside an active parallel region encounters a parallel
construct, the new team which is created will consist of only the encountering
thread, when any of the following conditions hold:
* nested parallelism is disabled."
> 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 bug2837.f90
! Derived from OpenMP test omp1/F2_2_9g.f90
use omp_lib
implicit none
integer, parameter :: NT = 4
integer :: nThreads(NT)
integer :: tmp = 0
!$ call omp_set_dynamic(.false.)
!$ call omp_set_num_threads(NT)
print *, 'omp_get_nested()=',omp_get_nested()
!$omp parallel default(private) shared(nThreads)
tmp = 1
!$omp parallel default(shared)
!$omp atomic
tmp = tmp + omp_get_thread_num() + 1
!$omp end parallel
nThreads(omp_get_thread_num()+1) = tmp
!$omp end parallel
print *, nThreads
END
> ftn -O3 -fopenmp -o x bug2837.f90
> aprun -n 1 ./x
omp_get_nested()= F
1 1 1 1
Application 4711 resources: utime 0, stime 0
Expected output (from PGI compilation):
> ftn -o x -O3 -mp -Mconcur=nonuma bug2837.f90
bug2837.f90:
> aprun -n 1 ./x
Warning: omp_set_num_threads (4) greater than available cpus (1)
omp_get_nested()= F
2 2 2 2
Application 4712 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: INCORRECT OUTPUT OBTAINED FROM NESTED PARALLELISM THAT
IS SERIALIZED
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=32551
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/32551] incorrect output obtained from nested parallelism that is serialized
2007-06-29 18:58 [Bug fortran/32551] New: INCORRECT OUTPUT OBTAINED FROM NESTED PARALLELISM THAT IS SERIALIZED longb at cray dot com
@ 2007-06-29 21:28 ` dfranke at gcc dot gnu dot org
2007-07-02 12:04 ` jakub at gcc dot gnu dot org
2007-07-02 12:05 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-29 21:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dfranke at gcc dot gnu dot org 2007-06-29 21:28 -------
Seems to be fixed in trunk:
$> gfortran-svn -g -Wall -fopenmp pr32551.f90 && ./a.out
omp_get_nested()= F
2 2 2 2
$> gfortran-svn -v
gcc version 4.3.0 20070628 (experimental)
As I am not 100% sure whether I fully understand your testcase (e.g. why expect
2 as a result, not somethinig from 2-5, depending on the thread hitting the
innermost parallel-region first?), I won't close it yet. Maybe Jakub has
something to say on this?!
--
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
GCC build triplet|x86_64-suse-linux |
GCC host triplet|x86_64-suse-linux |
GCC target triplet|x86_64-suse-linux |
Keywords| |openmp
Summary|INCORRECT OUTPUT OBTAINED |incorrect output obtained
|FROM NESTED PARALLELISM THAT|from nested parallelism that
|IS SERIALIZED |is serialized
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32551
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/32551] incorrect output obtained from nested parallelism that is serialized
2007-06-29 18:58 [Bug fortran/32551] New: INCORRECT OUTPUT OBTAINED FROM NESTED PARALLELISM THAT IS SERIALIZED longb at cray dot com
2007-06-29 21:28 ` [Bug fortran/32551] incorrect output obtained from nested parallelism that is serialized dfranke at gcc dot gnu dot org
@ 2007-07-02 12:04 ` jakub at gcc dot gnu dot org
2007-07-02 12:05 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 12:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2007-07-02 12:04 -------
If omp_get_nested() returns .false. (it doesn't have to, e.g. try
running the program with OMP_NESTED=1 in env), then it really should print
2 2 2 2
because only the outer parallel is parallelized and in the inner parallel
omp_get_thread_num () must always return 0.
This bug has been fixed recently though, see PR32362.
*** This bug has been marked as a duplicate of 32362 ***
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32551
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/32551] incorrect output obtained from nested parallelism that is serialized
2007-06-29 18:58 [Bug fortran/32551] New: INCORRECT OUTPUT OBTAINED FROM NESTED PARALLELISM THAT IS SERIALIZED longb at cray dot com
2007-06-29 21:28 ` [Bug fortran/32551] incorrect output obtained from nested parallelism that is serialized dfranke at gcc dot gnu dot org
2007-07-02 12:04 ` jakub at gcc dot gnu dot org
@ 2007-07-02 12:05 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-07-02 12:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2007-07-02 12:05 -------
If you remove = 0 after tmp decl and add tmp = 0 on a line right below it
(so that tmp isn't saved), it will work just fine even with pre-PR32362
gfortran.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32551
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-02 12:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-29 18:58 [Bug fortran/32551] New: INCORRECT OUTPUT OBTAINED FROM NESTED PARALLELISM THAT IS SERIALIZED longb at cray dot com
2007-06-29 21:28 ` [Bug fortran/32551] incorrect output obtained from nested parallelism that is serialized dfranke at gcc dot gnu dot org
2007-07-02 12:04 ` jakub at gcc dot gnu dot org
2007-07-02 12:05 ` 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).