public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/35517] New: OpenMP: Incorrect result when run with two or more threads
@ 2008-03-09 19:58 bart dot vanassche at gmail dot com
2008-03-09 19:59 ` [Bug libgomp/35517] " bart dot vanassche at gmail dot com
2008-03-10 18:33 ` bart dot vanassche at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: bart dot vanassche at gmail dot com @ 2008-03-09 19:58 UTC (permalink / raw)
To: gcc-bugs
The attached program is a straightforward implementation of matrix inversion
via the Gauss-Jordan algorithm. The explicitly parallelized version (not
attached) produces exactly the same result for each run independent of the
number of threads. The version parallelized via OpenMP produces incorrect
results for sufficiently large matrices and two or more threads. An example:
$ OMP_NUM_THREADS=1 ./matinv_openmp 180
error = 4.75689e-14; epsilon = 2.22045e-16; error / (epsilon * n) = 1.19018
Error within bounds.
$ OMP_NUM_THREADS=2 ./matinv_openmp 180
error = nan; epsilon = 2.22045e-16; error / (epsilon * n) = nan
Error out of bounds.
I compiled this program as follows:
$ ~/gcc-4.2.3/bin/gcc -Wall -fopenmp -g matinv_openmp.c -static -o
matinv_openmp -lm
$ ~/gcc-4.2.3/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/bart/software/gcc-4.2.3/configure --disable-nls
--enable-threads=posix --enable-tls --prefix=/home/bart/gcc-4.2.3
Thread model: posix
gcc version 4.2.3
--
Summary: OpenMP: Incorrect result when run with two or more
threads
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: libgomp
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bart dot vanassche at gmail dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35517
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libgomp/35517] OpenMP: Incorrect result when run with two or more threads
2008-03-09 19:58 [Bug libgomp/35517] New: OpenMP: Incorrect result when run with two or more threads bart dot vanassche at gmail dot com
@ 2008-03-09 19:59 ` bart dot vanassche at gmail dot com
2008-03-10 18:33 ` bart dot vanassche at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: bart dot vanassche at gmail dot com @ 2008-03-09 19:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from bart dot vanassche at gmail dot com 2008-03-09 19:58 -------
Created an attachment (id=15286)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15286&action=view)
Test program matinv_openmp.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35517
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libgomp/35517] OpenMP: Incorrect result when run with two or more threads
2008-03-09 19:58 [Bug libgomp/35517] New: OpenMP: Incorrect result when run with two or more threads bart dot vanassche at gmail dot com
2008-03-09 19:59 ` [Bug libgomp/35517] " bart dot vanassche at gmail dot com
@ 2008-03-10 18:33 ` bart dot vanassche at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: bart dot vanassche at gmail dot com @ 2008-03-10 18:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from bart dot vanassche at gmail dot com 2008-03-10 18:32 -------
Everything works correctly after changing
#pragma omp parallel for
into
#pragma omp parallel for private(j, k)
--
bart dot vanassche at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35517
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-10 18:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-09 19:58 [Bug libgomp/35517] New: OpenMP: Incorrect result when run with two or more threads bart dot vanassche at gmail dot com
2008-03-09 19:59 ` [Bug libgomp/35517] " bart dot vanassche at gmail dot com
2008-03-10 18:33 ` bart dot vanassche at gmail 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).