ICC should not generate warning about "#pragma omp ..." when OMP is disabled

ICC should not generate warning about "#pragma omp ..." when OMP is disabled

Ritratto di Marián "VooDooMan" Meravý

Greetings,

ICC 13.0, MSVC 2010

When I disable OpenMP support of ICC, it is displaying bunch of warnings in build log like:

c:path/to/file.h(439): warning #161: unrecognized #pragma

    #pragma omp sections

            ^
this warning is abusing me.

I have many OMP pragma's in the code, and when I do benchmarks without OpenMP support versus with OpenMP support, I might miss some IMPORTANT warning hidden somewhere in thousands of these warnings.

I don't want to pass to compiler "/Qwd161" do disable warning about invalid pragma's, since I am afraid of typo in other pragma's, so I would expect warning in this case as non-false positive.

Any objections? This is just a suggestion. TIA!

-- With best regards, VooDooMan - If you find my post helpful, please rate it and/or select it as a best answer where applies. Thank you.
13 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Igor Levicki

Why don't you just compile with openmp serial code? That way all omp pragmas will still be valid, just the code will be executed sequentially.

If you don't like that idea for some reason you can try doing something like this:

#ifdef _OPENMP

#define OMP(x)	omp x

#else

#define OMP(x)	message("")

#endif

-- Regards, Igor Levicki If you find my post helpfull, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di Marián "VooDooMan" Meravý
Quoting Igor Levicki Why don't you just compile with openmp serial code? That way all omp pragmas will still be valid, just the code will be executed sequentially.

If you don't like that idea for some reason you can try doing something like this:
- collapse sourceview plaincopy to clipboardprint?

  1. #ifdef_OPENMP
  2. #defineOMP(x)ompx
  3. #else
  4. #defineOMP(x)message("")
  5. #endif

#ifdef _OPENMP

#define OMP(x)	omp x

#else

#define OMP(x)	message("")

#endif

Ugly hack with preprocessor is rather a workaround then a serious solution, and it has adverse side effect of printing many empty lines into build log.

I don't want to switch it to serial code, because I'm afraid run-time linking OMP .dll might cause overhead, compared to completely turned off the OMP.

-- With best regards, VooDooMan - If you find my post helpful, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di Tim Prince

Not knowing whether by "switch it to serial" you mean setting OMP_NUM_THREADS=1, here's another option: link against libompstubs library. I doubt you could measure the associated startup time, and the stubs calls almost certainly are faster than the normal ones.

Ritratto di Marián "VooDooMan" Meravý
Quoting TimP (Intel) Not knowing whether by "switch it to serial" you mean setting OMP_NUM_THREADS=1, here's another option: link against libompstubs library. I doubt you could measure the associated startup time, and the stubs calls almost certainly are faster than the normal ones.

By sequential I meant in MSVS "Generate Sequential Code (/Qopenmp_stubs)", is this what you meant by "stubs" ? I don't care much about start-up time, but I am afraid of (possibly) creating unused thread by OpenMP library by using this option, which could affect running performance (I don't mind about start-up performance).

But some switch would be really sexy. Just like "ignore '#pragma omp' at all when OMP is not understood/turned on", w/o a warning, so I will need not to use switch to ignore warning, nor use preprocessor hacks, nor using "sequential OMP".

-- With best regards, VooDooMan - If you find my post helpful, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di Tim Prince

Yes, /QOpenmp_stubs will avoid creating threads for OpenMP.

Ritratto di Brandon Hewitt (Intel)

Unfortunately there isn't currently a clean way to do this, but I like the idea, so I've submitted a feature request to our front end team to create a different warning to explicitly diagnose unrecognized OpenMP pragmas separately.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"
Ritratto di Marián "VooDooMan" Meravý
Quoting Brandon Hewitt (Intel) Unfortunately there isn't currently a clean way to do this, but I like the idea, so I've submitted a feature request to our front end team to create a different warning to explicitly diagnose unrecognized OpenMP pragmas separately.

You mean when OpenMP support is disabled, it should generate for "#pragma omp ..." special warning (not one like in current implementation "unrecognised pragma"), but special warning like "OMP is disabled, ignoring #pragma omp" with its separate warning number? So one could easily disable only OMP warnings, but not ALL #pragma warnings? If so, I like the idea to have separate warning number for this.

-- With best regards, VooDooMan - If you find my post helpful, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di Igor Levicki

As I said (and Tim confirmed), switching to serial OpenMP code will solve your problem.

If you disable warning you may forget to re-enable OpenMP later. I really don't see a need for special treatment here.

Finally, instead of using message("") like in my example you can use any other NOP construct that won't generate any code or add any empty lines.

-- Regards, Igor Levicki If you find my post helpfull, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di Marián "VooDooMan" Meravý

Quote:

IgorLevicki wrote:

As I said (and Tim confirmed), switching to serial OpenMP code will solve your problem.

If you disable warning you may forget to re-enable OpenMP later. I really don't see a need for special treatment here.

Finally, instead of using message("") like in my example you can use any other NOP construct that won't generate any code or add any empty lines.

Greetings,

which NOP pragma construct you would suggest? Because even "#pragma ivdep" is causing warning/remark message (since it is not in the front of a loop). I have came thru ICC documentation and maybe I am blind, but I don't see NOP pragma generating ***NONE*** output in the build log.

And yes, switching OMP to generate serial code is remedy... but I guess it is just another JMP instruction into OpenMP DLL exported procedures table (or maybe followed by CALL instruction @ Windows) which could waste performance due to instruction cache flush. CALL maybe don't flush cache in all cases, but I guess JMP (as it is implemented on Windows) does indeed in any case (at least L1 cache ; maybe not L2 one).

-- With best regards, VooDooMan - If you find my post helpful, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di Marián "VooDooMan" Meravý

Quote:

blhewitt wrote:

Unfortunately there isn't currently a clean way to do this, but I like the idea, so I've submitted a feature request to our front end team to create a different warning to explicitly diagnose unrecognized OpenMP pragmas separately.

Greetings, this I would very appreciate. Thank you.
-- With best regards, VooDooMan - If you find my post helpful, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di Marián "VooDooMan" Meravý

Quote:

vdm_adfp wrote:

Quote:

blhewittwrote:

Unfortunately there isn't currently a clean way to do this, but I like the idea, so I've submitted a feature request to our front end team to create a different warning to explicitly diagnose unrecognized OpenMP pragmas separately.

Greetings,

this I would very appreciate.

Thank you.

Or maybe some specific pragmas, like: #pragma warning( push ) # pragma warning( disable: <specific_number_of_ICC_warning/remark> ) // code #pragma warning( pop ) that I can use in the front of all header files, i.e. in the main, first *.h file of includes (in this case without "push" like -> ) #ifdef DISABLE_OMP_THINGIE_ETC # pragma warning( disable: <specific_number_of_ICC_warning/remark> ) #endif
-- With best regards, VooDooMan - If you find my post helpful, please rate it and/or select it as a best answer where applies. Thank you.
Ritratto di jimdempseyatthecove

Try a variation on Igor's suggestion

#ifndef _OPENMP
#define omp comment
#endif

Jim Dempsey

www.quickthreadprogramming.com

Accedere per lasciare un commento.