linux-il  

With and Without gcc OMP

Orna Agmon Ben-Yehuda
Mon, 24 Sep 2007 05:22:28 -0700

Hi All,

I am trying to compile the same code using gcc 4.2, which has gomp (gnu open mp - a library for automatic thread paralelization) already in it. I want the code to still compile cleanly (using -Werror) without openMP at all, because it is said that there is a performance penalty to compiling with openMP, even if not using it (that is, defining the number of threads at runtime to be 1).

I would also like to be able to still compile the code cleanly on prior versions of gcc, specifically on 3.4.* which I currently use.

The problem is that in order to use OMP I need to insert pragmas such as

#pragma omp for

And both gcc 3.4.4 and gcc 4.2 without the -fopenmp flag complain about ignoring a pragma for each such line.

I tried hiding the pragma using a construct such as

#ifdef HAVE_OMP
#define MYOMP(C) C
#else
#define MYOMP(C)
#endif

But it seems that pragmas are parsed before defines are parsed, so this construct creates multiple errors when used:

MYOMP(#pragma omp for)

In gcc 4.2 there are two -W switches to control pragma warnings:
-Wno-pragmas - controls errors in known pragmas
and
-Wunknown-pragmas
To create extra warnings for pragmas in system headers.

Those do not exist in gcc 3.4, and anyway do not help me even in gcc 4.2 without -fopenmp, because the warnings I get are included in -Wall, which I wish to use when I compile (I already have a compilation line of several lines length, imagine what would happen if I did NOT use -Wall).

Any ideas?

Happy Sukkot,

Orna.
(Haifuxers - sorry for double posting - I am still waiting for my mail to arrive the mailing list...)

--
Orna Agmon Ben-Yehuda http://ladypine.org/
ICQ: 348759096


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]