[Omp] A problem with guard objects and exceptions on Intel

Haab, Grant grant.haab at intel.com
Fri Aug 25 10:17:51 PDT 2006


Michael,

I forgot to mention that I think your guard idea on the web site you
mentioned is very interesting. I really like the idea that you can use
these guards for exception-safe "critical sections" that get
automatically unlocked when an exception is thrown outside of "scope" of
the construct.

-Grant


-----Original Message-----
From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf
Of Michael Suess
Sent: Friday, August 25, 2006 8:12 AM
To: Omp at openmp.org
Subject: Re: [Omp] A problem with guard objects and exceptions on Intel

Hi Grant,

thank you very much for taking care of this, looking forward to seeing
this 
fixed!

Best regards,
Michael

On Wednesday 23 August 2006 19:59, Haab, Grant wrote:
> Michael,
>
> I have reproduced the segmentation fault you mention below with your
> source code.  I am in the process of submitting a bug for the Intel
> Compiler on your behalf.  Thanks for bringing this issue to our
> attention.
>
> As you suggested in another e-mail, the bug seems to have nothing to
do
> with shell stack size.  It does not fail every time, so perhaps the
> intermittent nature misled some folks to associate it with shell stack
> size setting.
>
> Best regards,
>
> - Grant
>
> Grant Haab
> Compiler Developer
> Intel Corporation
>
> -----Original Message-----
> From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf
> Of Michael Suess
> Sent: Tuesday, August 22, 2006 10:55 AM
> To: omp at openmp.org
> Subject: [Omp] A problem with guard objects and exceptions on Intel
>
> Hi,
>
> I have just published a blog entry comparing the merits of guard
objects
> vs.
> the critical construct (with C++ and OpenMP). The problem I have now
is:
> My
> test programs with exceptions and guard objects do not work for the
> Intel
> Compiler. Since this would not be the first time I missed something, I
> figured I would double check here before filing a bug with Intel.
>
> So if you find the time, please take a look at the code for the guard
> object,
> enclosed in the following article:
>
http://www.thinkingparallel.com/2006/08/21/scoped-locking-vs-critical-in
> -openmp-a-personal-shootout/
>
> Combining this with the following short test program,
> test_omp_guard_exceptions.cpp:
>
> #include <omp.h>
> #include <cassert>
>
> #include "omp_guard.hpp"
>
> int main (void)
> {
> 	omp_lock_t my_lock;
>
> 	// how many exceptions have been thrown (should be one for each
> thread)
> 	int ex_count = 0;
>
> 	// how many threads will be created (most likely)
> 	int numthreads = omp_get_max_threads ();
>
> 	omp_init_lock (&my_lock);
>
> 	#pragma omp parallel
> 	{
> 		try {
> 			omp_guard my_guard (my_lock);
> 			throw omp_get_thread_num ();
> 		}
> 		catch(int e) {
> 			#pragma omp atomic
> 			++ex_count;
> 		}
> 	}
> 	assert (ex_count == numthreads);
> 	omp_destroy_lock (&my_lock);
>
> 	return 0;
> }
>
> Running this program on the Intel Compiler, I get a segmentation
fault.
> The
> Sun and Portland compilers run it just fine, so I think it may be a
bug
> in
> the compiler. But since I have had this thought one too many times in
> the
> past and usually it is me and not the compiler who is wrong, I thought
I
>
> would double-check.
>
> Thanks for any insights,
> Michael Suess

-- 
My blog on parallel programming: http://www.thinkingparallel.com
Michael Suess
Public PGP key: http://www.suessnetz.de/michael/michaelsuess.gpg
PGP key fingerprint: A744 AFBA CA93 620B 8701 AB98 D4CF 4F3C 945A 61FE
_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp


More information about the Omp mailing list