[Omp] Must OpenMP programs be optimized?

Marcel Beemster marcel at ace.nl
Mon Aug 27 00:31:51 PDT 2007


Qihang,

You wrote:
On Mon, Aug 27, 2007 at 04:26:13PM +1200, Qihang Huang wrote:
> I tried also to use SUNWspro cc instead of gcc 4.2. It has basically the
> same result: if I compile it with cc -xopenmp -xO3 gauss.c, then it runs
[...]
> > Does anyone have any idea why this happens? Is it some bug in my programs,
> > or some bug in gcc 4.2? Or it is because OpenMP programs must be optimized
> > in order to run correctly?

There is one definite answer: OpenMP programs do not require
optimization in order to run correctly.

Since you have problems with both GCC and SUN-cc (and they
are very different compiler platforms) I would NOT initially
suspect the compiler.

I would suspect an error in the program. Optimized codes
have different timing behaviour and different stack layout.
When running in parallel, both may cause your program to run
differently. In your case, since the problem is quite
reproducable, I think that the different stack layout
exposes a problem in the memory management (malloc/free) of
your program. Without the program source, there is not much
to say.

So, fire up the debugger and get a stacktrace of where
things go wrong. Work backward from here, simplify and add
trace or print statements to check that the program runs as
at should.

As a state of mind, doubting your (compiler) tools makes it
very difficult to find fault in your own codes.

Good luck,
	Marcel

-- 
Dr. Marcel Beemster, Senior Software Engineer, marcel at ace.nl,www.ace.nl
Associated Compiler Experts bv. Amsterdam, Netherlands. +31 20 6646416.
-----------------------------------------------------------------------
This e-mail and any  files transmitted  with it are  confidential.  Any
technical information contained herein is supplied as-is, and no rights
can be  derived therefrom.  If you have received this message in error,
please notify  the sender by reply  e-mail immediately,  and delete the
message and all copies thereof.




More information about the Omp mailing list