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

What -openmp does without any !$OMP directives

juansheng
Beginner
963 Views
Hi there,

I wrote a simple fortran 90 project with some modules involved. What supprising me is that building with -openmp option, program generates totally wrong results while there weren't any !$OMP directives in this project. Could anybody tell me what the option '-openmp' of ifort does when any codes haven't been embraced with !$OMP directives? Thanks.

Regards,
0 Kudos
23 Replies
pbkenned1
Employee
163 Views
This is still not fixed in Composer XE 2013 update #1 (ifort-13.0.1.117). I've pinged the developers. Our defect tracking system is not pubic, although we do list the defects that are fixed in each release. Patrick
0 Kudos
Martyn_C_Intel
Employee
163 Views

I took another look at this issue. One of my original suggestions turned out to be correct - the problem is an uninitialized variable.

The user code initializes the diagonal elements of the unit matrix I0, but not the off-diagonal elements, which are assumed to be zero. Whether this causes incorrect results depends on the optimization level, where variables are stored in memory, etc. A fix is to insert "I0=0"  before the forall statement at line 77 in calc_expMat.

The problem is much easier to detect using a new feature of the version 16 compiler:

$ ifort -O1 -auto -init=snan,array -traceback mat_tools.f90 global_mod.f90; ./a.out
  0.0000  0.00000E+00
forrtl: error (182): floating invalid - possible uninitialized real/complex variable.
Image              PC                Routine            Line        Source
a.out              0000000000475075  Unknown               Unknown  Unknown
a.out              0000000000472C97  Unknown               Unknown  Unknown
a.out              000000000042DD94  Unknown               Unknown  Unknown
a.out              000000000042DBA6  Unknown               Unknown  Unknown
a.out              0000000000407A66  Unknown               Unknown  Unknown
a.out              000000000040B327  Unknown               Unknown  Unknown
libpthread.so.0    00007FBDBFDB3340  Unknown               Unknown  Unknown
a.out              00000000004039C9  global_mod_mp_cal          79  global_mod.f90
a.out              0000000000403062  MAIN__                    125  global_mod.f90
a.out              00000000004025AE  Unknown               Unknown  Unknown
libc.so.6          00007FBDBF7FBEC5  Unknown               Unknown  Unknown
a.out              00000000004024A9  Unknown               Unknown  Unknown
Aborted (core dumped)

Intel(R) Inspector should also be able to detect this, though I haven't tried.

The internal defect will be closed. Sorry it took so long to figure this out.


 

0 Kudos
TimP
Honored Contributor III
163 Views
Intel changed spelling from -openmp to -qopenmp maybe better for the spell corrector.
0 Kudos
Reply