public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/45192]  New: OpenMP fails in DLLs
@ 2010-08-05  9:12 john at quivinco dot com
  2010-08-05  9:42 ` [Bug libgomp/45192] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: john at quivinco dot com @ 2010-08-05  9:12 UTC (permalink / raw)
  To: gcc-bugs

I have an OpenMP code segment:

#pragma omp parallel for
for (i = 0; i < size; i++)

Built with mingw gcc 4.4.0. Run on Windows XP SP3, AMD 64 Athlon FX62 dual
core.

Run in an exe application it works fine, however when invoked as code in a DLL
the for loop threads do not increment properly and the loop runs infinitely
repeating the same values of i.

eg:
19 thread 0
26936 thread 1
20 thread 0
0 thread 1
21 thread 0
19 thread 1
22 thread 0
20 thread 1
21 thread 1
23 thread 0
22 thread 1
0 thread 0
23 thread 1
19 thread 0
24 thread 1
20 thread 0
...


-- 
           Summary: OpenMP fails in DLLs
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john at quivinco dot com


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


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

* [Bug libgomp/45192] OpenMP fails in DLLs
  2010-08-05  9:12 [Bug libgomp/45192] New: OpenMP fails in DLLs john at quivinco dot com
@ 2010-08-05  9:42 ` rguenth at gcc dot gnu dot org
  2010-08-05 12:40 ` john at quivinco dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-05  9:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-08-05 09:42 -------
You probably have to build applications that use the DLL thread-aware.


-- 


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


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

* [Bug libgomp/45192] OpenMP fails in DLLs
  2010-08-05  9:12 [Bug libgomp/45192] New: OpenMP fails in DLLs john at quivinco dot com
  2010-08-05  9:42 ` [Bug libgomp/45192] " rguenth at gcc dot gnu dot org
@ 2010-08-05 12:40 ` john at quivinco dot com
  2010-08-06 20:49 ` john at quivinco dot com
  2010-08-17 11:58 ` john at quivinco dot com
  3 siblings, 0 replies; 5+ messages in thread
From: john at quivinco dot com @ 2010-08-05 12:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from john at quivinco dot com  2010-08-05 12:39 -------
Thanks, but how is that done? Is it in the documentation?

(In reply to comment #1)
> You probably have to build applications that use the DLL thread-aware.
> 


-- 


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


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

* [Bug libgomp/45192] OpenMP fails in DLLs
  2010-08-05  9:12 [Bug libgomp/45192] New: OpenMP fails in DLLs john at quivinco dot com
  2010-08-05  9:42 ` [Bug libgomp/45192] " rguenth at gcc dot gnu dot org
  2010-08-05 12:40 ` john at quivinco dot com
@ 2010-08-06 20:49 ` john at quivinco dot com
  2010-08-17 11:58 ` john at quivinco dot com
  3 siblings, 0 replies; 5+ messages in thread
From: john at quivinco dot com @ 2010-08-06 20:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from john at quivinco dot com  2010-08-06 20:48 -------
I just read this...

TDM-GCC has been built to allow the use of GCC's "-fopenmp" option for
generating parallel code as specified by the OpenMP API. (See
<http://gcc.gnu.org/onlinedocs/libgomp/> for details.) If you want to use
OpenMP in your programs, be sure to install the "openmp" optional package.

The OpenMP support in the TDM-GCC builds has received very little testing; if
you find build or packaging problems, please send a bug report (see BUGS
above).

LibGOMP, GCC's implementation of OpenMP, currently only supports the use of the
POSIX Threads (pthreads) api for implementing its threading model. Because the
MinGW project itself doesn't distribute a pthreads implementation, the
"pthreads-win32" library, available from http://sourceware.org/pthreads-win32/,
is included in this distribution. If you aren't familiar with pthreads-win32,
please read the file "pthreads-win32-README" for more information, or the
documentation available at the website referenced above. pthreads-win32 is
distributed under the terms of the LGPL; see "COPYING.lib-gcc-tdm.txt" for
details.

In order to correctly compile code that utilizes OpenMP/libGOMP, you need to
add
the "-fopenmp" option at compile time AND link time. By default, this will link
the standard C-cleanup DLL version of pthreads-win32 to your program, which
means that you will need to ensure that the file "pthreadGC2.dll" (included in
the "bin" subdirectory in the openmp package) can be found by your program. If
you plan to distribute a program that relies on pthreads-win32, be sure to
understand and comply with the terms of the LGPL (see COPYING.lib-gcc-tdm.txt).

"libpthread.a" is included in the "lib" subdirectory of the openmp package
along
with two other pthreads library files:
 - "libpthreadGC2-static.a" provides a static version of the pthreads-win32
     library, but it requires some additional non-POSIX-compliant startup code
     to be included in your program. See "pthreads-win32-README" for
     details.
 - "libpthreadGCE2.a" provides a version of the pthreads-win32 library with
     a somewhat safer response in the face of unexpected C++ exceptions.
     The creators of the pthreads-win32 library recommend, however, that this
     version not be used, because code written to rely on this is less
portable.

Anyone tried this or know where to get pthreadGC2.dll?


-- 


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


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

* [Bug libgomp/45192] OpenMP fails in DLLs
  2010-08-05  9:12 [Bug libgomp/45192] New: OpenMP fails in DLLs john at quivinco dot com
                   ` (2 preceding siblings ...)
  2010-08-06 20:49 ` john at quivinco dot com
@ 2010-08-17 11:58 ` john at quivinco dot com
  3 siblings, 0 replies; 5+ messages in thread
From: john at quivinco dot com @ 2010-08-17 11:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from john at quivinco dot com  2010-08-17 11:57 -------
The cause has been isolated to a problem with my C code. The DLL now works on
Windows XP, but not Vista 64!?


-- 

john at quivinco dot com changed:

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


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


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

end of thread, other threads:[~2010-08-17 11:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05  9:12 [Bug libgomp/45192] New: OpenMP fails in DLLs john at quivinco dot com
2010-08-05  9:42 ` [Bug libgomp/45192] " rguenth at gcc dot gnu dot org
2010-08-05 12:40 ` john at quivinco dot com
2010-08-06 20:49 ` john at quivinco dot com
2010-08-17 11:58 ` john at quivinco 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).