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

OpenMP and !DEC$ attributes

Pellegrini__Etienne
1,152 Views

I am using OpenMP and Intel Fortran within Visual Studio 2010 Ultimate. I am calling some functions that are exported from a homemade DLL using the attribute DLLEXPORT and aliases. I use DLLIMPORT for the importation. No problem there.

The problem comes when I try using an OpenMP sentinel (!$, without omp, as in !$ call omp_set_num_threads(4) for instance) right after those DLLIMPORT statements. The conditional compilation that is supposed to be performed by the compiler when using /Qopenmp does not work, and the statements seem to be ignored. However, if I have any standard Fortran statement between the !DEC$ and !$, no problem anymore. Same if the openMP statement is an actual openMP directive, usig !$omp instead of just !$. To resume:

      PROGRAM main

        !$ use omp_lib

        integer :: i

        !$ print*, 'OMP 1'
        !DEC$ ATTRIBUTES DLLIMPORT, ALIAS : 'func1'  :: func1
        !$ print*, 'OMP 2'

        i = 5
        !$ print*, 'OMP 3'

      end program

outputs: 'OMP 1'
              'OMP 3'

I have not found any references to this problem anywhere else, or any doc explicitly stating that an openMP sentinel should not directly follow a !DEC$ attributes statement, so I thought that maybe it was a bug that had not been discovered yet.

0 Kudos
5 Replies
pbkenned1
Employee
1,152 Views

Looks like an obscure bug with conditional compilation that hasn't been reported previously.  I'll discuss with the team and follow up.

Patrick

0 Kudos
pbkenned1
Employee
1,152 Views

Apparently this is a compiler front end bug, and it has been reported to compiler engineering (internal tracking ID DPD200362090).  I'll keep this thread updated with news from the developers.

Patrick

0 Kudos
Pellegrini__Etienne
1,152 Views

Thank you, Patrick!

0 Kudos
pbkenned1
Employee
1,152 Views

This issue has been fixed in a future version of the compiler.  I'll identify the version with the fix when it becomes available.

Patrick

0 Kudos
pbkenned1
Employee
1,152 Views

This is fixed in the 16.0 compiler, so I am closing this ticket now.

C:\ISN_Forums\U533490>ifort -Qopenmp  foo.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.0.110 Build 20150815
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:foo.exe
-subsystem:console
-defaultlib:libiomp5md.lib
-nodefaultlib:vcomp.lib
-nodefaultlib:vcompd.lib
foo.obj

C:\ISN_Forums\U533490>foo.exe
 OMP 1
 OMP 2
 OMP 3

C:\ISN_Forums\U533490>

0 Kudos
Reply