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

Compiler not detecting missing OMP4 declare target variable

Grund__Aalexander
894 Views

Most of the time, the compiler will complain if a global variable used in an OMP4 target region is not declared for the target (!$omp declare targt(foo))

But now I had a (very big) program that compiled without errors (finally after fixing all the missing declares) but failed at runtime with the message:

On the remote process, dlopen() failed. The error message sent back from the sink is /tmp/coi_procs/1/56338/load_lib/ifortoutfGrs7D: undefined symbol: control_parameters_mp_surface_pressure_
On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/56338/load_lib/ifortoutfGrs7D: undefined symbol: control_parameters_mp_surface_pressure_"
offload error: cannot load library to the device 0 (error code 20)

Investigating the code, I found that in module "control_parameters" a real variable "surface_pressure" was declared and used inside a target region. Nothing special there, just omp target, parallel do and do simd. However the compiler did not detect it.

How is this possible? "Just" a bug in the compiler or are there (documented) circumstances where this might not work?
I cannot post the code itself, as it is part of the SPEC ACCEL suite and reducing it is hard due to the code consisting of ~160 files and in most of them, it detects the missing declare (even same module and/or same target region)

0 Kudos
5 Replies
TimP
Honored Contributor III
894 Views

Some bugs appear to be fixed in ifort 14.0 update 2, where a target data declaration in the same application with target map previously produced such a dlopen() error, with the data symbol apparently interpreted as a function reference.

I didn't see how many moderately large applications could avoid running into this situation, which could come about without the source code being apparently at fault.

This seems not be the same situation as you describe (a shared variable not being covered by your target syntax but not flagged as an error?) but the end effect looks similar.

0 Kudos
Grund__Aalexander
894 Views

I am using ifort 14.0.2.

Setup is like this:
Module "control_parameters" with the variable in question listed as a real (among other definitions)
Program enters main data region in finction fooFunc of module foo (omp target data map(...)) and calls the function barFunc in module bar.
In barFunc I have something like:
[fortran]
!$omp target
!$omp parallel do
do i=0,x
!$omp simd
do j=0,y
newValue=someArray(i,j)*(someReal - surface_pressure)
!...
end do
end do
!$omp end target
[/fortran]

I cannot provide full source in public, but it is possible to send it to Intel, if they are interested.

0 Kudos
pbkenned1
Employee
894 Views

Hello Alexander,

Yes, we are interested.  Can you file a Intel Premier support issue and attach your source code?

Thanks,

Patrick

0 Kudos
pbkenned1
Employee
894 Views

ifort-14.0.2 should have detected that surface_pressure was not listed as '!$omp declare target' and produced error #8663, eg:

error #8663: A global variable used in an OpenMP* TARGET region must have the DECLARE TARGET attribute.   [SURFACE_PRESSURE]

This has been reported to the developers a defect #DPD200254915.  I'll keep this thread updates with the progress to repair.

A development compiler does produce a comp fail, but that's not any easier to debug than the runtime error:

/tmp/ifortMICkURAPG: In function `L_prandtl_fluxes__359__par_region18_2_19':
/pbkenned/ISN_Forums/U508218/intelerror2/prandtl_fluxes.F90:360: undefined reference to `control_parameters_mp_surface_pressure_'
/pbkenned/ISN_Forums/U508218/intelerror2/prandtl_fluxes.F90:360: undefined reference to `control_parameters_mp_surface_pressure_'

 

Patrick
 

0 Kudos
pbkenned1
Employee
894 Views

This issue is now fixed in ifort 15.0 beta update #1, aka Version 15.0.0.040 Beta Build 20140428. 

The compiler will now see that variable surface_pressure was not annotated with the DECLARE TARGET attribute:

 

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.040 Beta Build 20140428

 

$ ifort -openmp -g -O0 -fpp -DSPEC -D__nopointers -D__lc -free -extend-source 132 -c *.F90

prandtl_fluxes.F90(374): error #8663: A global variable used in an OpenMP* TARGET region must have the DECLARE TARGET attribute.   [SURFACE_PRESSURE]
                   q(k,j,i) = 0.622 * e_q / ( surface_pressure - e_q )
----------------------------------------------^
compilation aborted for prandtl_fluxes.F90 (code 1)

 

Patrick
 

0 Kudos
Reply