Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

/Qopenmp when not using OpenMP

netphilou31
New Contributor III
5,414 Views

Hi,

Since I was not sure to post my message at the right place, this is a repost of the thread /Qopenmp when not using OpenMP - Intel Community

I'd like to know the effect of adding the /Qopenmp compiler switch (IFORT) even when I'm not using OpenMP directives at all. 
To illustrate this, I have a dll that needs to be compiled with this switch to be thread safe. The dll works the same with and without it, however, I'm pretty sure some parts of the code are NOT thread safe and strangely seem to behave safely with this option! The calling process does not use critical sections and there are no critical sections in the source code.

Does anyone know what is happening behind the scenes when turning on this compiler switch?

Regards,

Phil.

0 Kudos
1 Solution
Barbara_P_Intel
Employee
5,340 Views

I checked with one of Intel's infamous Fortran compiler engineers and got this info:

The default is /reentrancy:threaded and has been for a couple of releases. This means that we always link against the threadsafe libraries now, for both ifx and ifort.

/Qopenmp sets /Qauto automatically making all variables into stack variables by default, instead of declaring them essentially on the heap.

View solution in original post

0 Kudos
21 Replies
jimdempseyatthecove
Honored Contributor III
378 Views

IIF is shorthand for If and only If.

 

You will need to walk through your dll2 code to verify that it is threadsafe. This includes any static libraries that are libraried into dll2 (as they may have been libraried with sequential code).

There is no magic wand you can wave over your code to pronounce it is thread safe.

 

Jim Dempsey

 

0 Kudos
Reply