Strange bug

General OpenMP discussion

Strange bug

Postby hildy » Fri Aug 22, 2008 12:38 am

Hi!
I have run into a very strange bug. It is ne function that is parallelized. This function works perfectly fine with just one thread or when commenting the parallel directive. When there is more than one thread, it seems like the master thread doesn't exit the parallel section. Even if I, inside the parallel section, directly put a single clause that covers the entire "parallel"-code the same error occurs. When I try to debug the program with gdb/eclipse (I can't see the variable values inside parallel scopes) It shows every thread at the end of the function. This I interpreted as if all the threads has executed their designated tasks and parked at the end of the function. So why won't the master thread return from the function?
Also, the for directive gives sigsegv error if I try to set schedule to "dynamic", "guided" or "runtime".
I think it seems like a openmp-error and not an implementation-error. There might be a possibility that another thread executes another openmp-parallelized function in parallel with this function call. Could this be a factor to why it doesn't work?
Has anybody experienced the same behaviour.

I run:
Ubuntu 8.04 64-bit on a Intel core2 quad processor. I compile with gcc 4.3.1 and I debug with GDB in eclipse.
I have tried both with omp_dynamic and omp_nested enabled and disabled.
hildy
 
Posts: 14
Joined: Mon Jun 30, 2008 2:39 am

Re: Strange bug

Postby hildy » Fri Aug 22, 2008 1:09 am

The only thing that seems odd about the function call that make the parallel section hang is that the function is a pure virtual function and is defined in another class that inherites the current class. Could it be some kind of inheritance bug in openMP??
hildy
 
Posts: 14
Joined: Mon Jun 30, 2008 2:39 am

Re: Strange bug

Postby mwolfe » Mon Aug 25, 2008 3:42 pm

Without your code, it's hard to try to debug it. It sounds like you have an OpenMP parallel for loop that contains a function call, and the program hangs at the function. Or is it a loop with a function call where the omp parallel appears inside the function? Or something else?

It might be the case that the function itself isn't thread-safe, for some reason. Are you using OpenMP in parallel with another threading package, pthreads or something?
-mw
mwolfe
 
Posts: 54
Joined: Mon Aug 25, 2008 3:19 pm

Re: Strange bug

Postby hildy » Tue Sep 02, 2008 5:05 am

It is an OpenMP parallel for loop that contains a functions call. When this function call is commented the programm runs smoothly (of course it can't do what it is intended to do then though:( ). Yes we use pthreads in the same program. Could it be some kind of problem in using pthreads and openmp at the same time? The function itself should be threadsafe. I would love to show you the code but I work with a commercial software and there is secrecy arrangements that prohibit me from doing that.
hildy
 
Posts: 14
Joined: Mon Jun 30, 2008 2:39 am

Re: Strange bug

Postby ejd » Tue Sep 02, 2008 5:59 am

I don't know if this applies or not, but there was another posting (topic OpenMP + Pthreads problem) that indicated that gcc and OpenMP pragmas didn't "play nicely" together. Check that posting for a reference to the gcc bugzilla bug for more information.

It does sound like an implementation problem. While you have said that you can not provide the code, unless you can provide a small example that shows the problem, the gcc implementers may not be able to fix the problem (if it isn't the problem above). Good luck.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am

Re: Strange bug

Postby hildy » Tue Sep 02, 2008 9:17 am

pThreads is not used from within the same function but the function executing the parallel code is part of a pThread tree itself. So there exist other simultaneous task on other pThreads in the meantime. Some of them might be executing some openMP directives too.
hildy
 
Posts: 14
Joined: Mon Jun 30, 2008 2:39 am


Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 7 guests