public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
@ 2012-11-20 10:03 jk3064 at arcor dot de
  2012-11-20 10:04 ` [Bug libgomp/55411] " jk3064 at arcor dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jk3064 at arcor dot de @ 2012-11-20 10:03 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55411
           Summary: OMP threads lose their OMP_WAIT_POLICY when another
                    OMP thread gets destructed
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jk3064@arcor.de


So there are 2 bugs:
 * the omp workers of a boost::thread are ignoring OMP_WAIT_POLICY
 * once the boost::thread gets destructed the main-thread's omp worker's
WAIT_POLICY get lost

used to compile the example:
g++ -fopenmp -lgomp -lboost_system -lboost_thread-mt -o foo.bin -O2 foo_omp.c

tested with gentoo:
Just run the example with `export OMP_WAIT_POLICY="ACTIVE"` and watch it in
another window with htop. First all created omp threads use 100%, then the
boost::thread and its omp workers are spawned (all with ~0% cpu usage, still
the main-thread's omp workers use 100%). Then the boost::thread gets destructed
and the main-threads omp workers fallback to 0% cpu usage.

PS: It would be nice if there was a GOMP_DEBUG to enable a more verbose output,
esp. to debug GOMP_SPINCOUNT & OMP_PROC_BIND.


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

* [Bug libgomp/55411] OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
  2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
@ 2012-11-20 10:04 ` jk3064 at arcor dot de
  2012-11-21  2:14 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jk3064 at arcor dot de @ 2012-11-20 10:04 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from jk3064 at arcor dot de 2012-11-20 10:04:08 UTC ---
Created attachment 28742
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28742
example testcase

compile with: g++ -fopenmp -lgomp -lboost_system -lboost_thread-mt -o foo.bin
-O2 foo_omp.c


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

* [Bug libgomp/55411] OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
  2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
  2012-11-20 10:04 ` [Bug libgomp/55411] " jk3064 at arcor dot de
@ 2012-11-21  2:14 ` pinskia at gcc dot gnu.org
  2012-11-21  3:20 ` jk3064 at arcor dot de
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-11-21  2:14 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-11-21 02:13:37 UTC ---
Can you create a testcase which uses pthread_* directly?


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

* [Bug libgomp/55411] OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
  2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
  2012-11-20 10:04 ` [Bug libgomp/55411] " jk3064 at arcor dot de
  2012-11-21  2:14 ` pinskia at gcc dot gnu.org
@ 2012-11-21  3:20 ` jk3064 at arcor dot de
  2012-11-21 10:31 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jk3064 at arcor dot de @ 2012-11-21  3:20 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from jk3064 <jk3064 at arcor dot de> 2012-11-21 03:20:26 UTC ---
Created attachment 28748
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28748
pthread only testcase


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

* [Bug libgomp/55411] OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
  2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
                   ` (2 preceding siblings ...)
  2012-11-21  3:20 ` jk3064 at arcor dot de
@ 2012-11-21 10:31 ` jakub at gcc dot gnu.org
  2012-11-21 20:30 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-21 10:31 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-11-21
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-21 10:31:33 UTC ---
Created attachment 28752
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28752
gcc48-pr55411.patch

Untested fix.


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

* [Bug libgomp/55411] OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
  2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
                   ` (3 preceding siblings ...)
  2012-11-21 10:31 ` jakub at gcc dot gnu.org
@ 2012-11-21 20:30 ` jakub at gcc dot gnu.org
  2012-11-21 20:32 ` jakub at gcc dot gnu.org
  2012-12-02 17:26 ` jk3064 at arcor dot de
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-21 20:30 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-21 20:29:28 UTC ---
Author: jakub
Date: Wed Nov 21 20:29:14 2012
New Revision: 193706

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193706
Log:
    PR libgomp/55411
    * team.c (gomp_free_thread): Decrease gomp_managed_threads
    if pool had any threads_used.

Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/team.c


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

* [Bug libgomp/55411] OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
  2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
                   ` (4 preceding siblings ...)
  2012-11-21 20:30 ` jakub at gcc dot gnu.org
@ 2012-11-21 20:32 ` jakub at gcc dot gnu.org
  2012-12-02 17:26 ` jk3064 at arcor dot de
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-21 20:32 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-21 20:31:43 UTC ---
Author: jakub
Date: Wed Nov 21 20:31:31 2012
New Revision: 193707

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193707
Log:
    PR libgomp/55411
    * team.c (gomp_free_thread): Decrease gomp_managed_threads
    if pool had any threads_used.

Modified:
    branches/gcc-4_7-branch/libgomp/ChangeLog
    branches/gcc-4_7-branch/libgomp/team.c


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

* [Bug libgomp/55411] OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed
  2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
                   ` (5 preceding siblings ...)
  2012-11-21 20:32 ` jakub at gcc dot gnu.org
@ 2012-12-02 17:26 ` jk3064 at arcor dot de
  6 siblings, 0 replies; 8+ messages in thread
From: jk3064 at arcor dot de @ 2012-12-02 17:26 UTC (permalink / raw)
  To: gcc-bugs


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

jk3064 <jk3064 at arcor dot de> changed:

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

--- Comment #7 from jk3064 <jk3064 at arcor dot de> 2012-12-02 17:26:14 UTC ---
Thank you!
That fixed it.
The omp threads of the 2nd thread obv. still don't copy the policies of the
main one, but this would be even counterproductive (you would have ~twice more
threads with 100% cpu usage than you got cores). This could only be solved with
an either process or OS shared workerpool, what is another topic. So the ticket
can be closed :)


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

end of thread, other threads:[~2012-12-02 17:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-20 10:03 [Bug libgomp/55411] New: OMP threads lose their OMP_WAIT_POLICY when another OMP thread gets destructed jk3064 at arcor dot de
2012-11-20 10:04 ` [Bug libgomp/55411] " jk3064 at arcor dot de
2012-11-21  2:14 ` pinskia at gcc dot gnu.org
2012-11-21  3:20 ` jk3064 at arcor dot de
2012-11-21 10:31 ` jakub at gcc dot gnu.org
2012-11-21 20:30 ` jakub at gcc dot gnu.org
2012-11-21 20:32 ` jakub at gcc dot gnu.org
2012-12-02 17:26 ` jk3064 at arcor dot de

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