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

-static-intel causes OpenMP data races ?

Alexis_R_
New Contributor I
469 Views
Using:
ifort 12.1.0
intel inspector XE 2011 Update 7 (build 189290)
On: RHEL 5, 64bit

The following file test.f90:
[fortran]module mod
 contains
	!>	\brief	Test whether OpenMP is available
	LOGICAL FUNCTION OPENMP_IS_AVAILABLE()
		USE OMP_LIB
		IMPLICIT NONE
		! Arguments

		! Private variables

		! Start work

		!$OMP	PARALLEL    &
		!$OMP          SHARED(OPENMP_IS_AVAILABLE)
		!$OMP	SINGLE
		IF (OMP_GET_ACTIVE_LEVEL() .GT. 0) THEN
			OPENMP_IS_AVAILABLE = .TRUE.
		ELSE
			OPENMP_IS_AVAILABLE = .FALSE.
		ENDIF
		!$OMP	END SINGLE
		!$OMP	END PARALLEL
	END FUNCTION OPENMP_IS_AVAILABLE
end module mod

program omptest

  use mod
  if (openmp_is_available()) then
   write(*,'(a)') 'openmp is available'
  endif

end program omptest[/fortran]

Compiled like this:
[bash]ifort -openmp -static-intel test.f90[/bash]
And then thread-checked with Inspector (analysis type "Locate Deadlocks and Data Races", stack frame depth 24, scope "Extremely thorough") gives a number of Data races:
[bash]ID  Problem Sources Modules State
P1  Data race [Unknown] a.out Not fixed
P2  Data race [Unknown] a.out Not fixed
P3  Data race [Unknown] a.out Not fixed
P4  Data race [Unknown] a.out Not fixed
P5  Data race [Unknown] a.out New
P6  Data race [Unknown] a.out Not fixed
P7  Data race [Unknown] a.out Not fixed
P8  Data race [Unknown] a.out Not fixed
P9  Data race [Unknown] a.out Not fixed
P10  Data race [Unknown] a.out Not fixed
P11  Data race [Unknown] a.out Not fixed
P12  Data race [Unknown] a.out Not fixed
P13  Data race [Unknown] a.out Not fixed
P14  Data race [Unknown] a.out Not fixed
P15  Data race [Unknown] a.out Not fixed
P16  Data race [Unknown] a.out Not fixed
[/bash]
Removing the -static-intel option from the compile line solves the problem, but it took me a while to figure out what was going on, so perhaps this is worth fixing? Or is this behaviour expected?

Thanks
0 Kudos
2 Replies
pbkenned1
Employee
469 Views
Thanks for the report. There are two issues here.

First, there's an ifort driver bug because -static-intel is supposed to link everything statically, except for the OpenMP runtime library. But that's not happening:

> ifort -V

Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.0.233 Build 20110811

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

> ifort -openmp -static-intel U87100.f90 -o U87100-static-intel.x

> ldd U87100-static-intel.x

libm.so.6 => /lib64/libm.so.6 (0x00002aaaaabc7000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aaaaad1c000)

libc.so.6 => /lib64/libc.so.6 (0x00002aaaaae33000)

libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002aaaab065000)

libdl.so.2 => /lib64/libdl.so.2 (0x00002aaaab172000)

/lib64/ld-linux-x86-64.so.2 (0x00002aaaaaaab000)

>

Second, Inspector is known to report false positives when linking the static OpenMP runtime. I suspect that's why when you remove -static-intel and link dynamically, all is well. So really, the secondissue is just a side-effect of the driver/linking bug.

I'll file a bug report for the first issue. You know how to deal with the second issue.

Patrick Kennedy
Intel Developer Support

0 Kudos
pbkenned1
Employee
469 Views
The tracking number for this defect is DPD200174693. I'll keep this thread updated with the progress to repair.

Patrick
0 Kudos
Reply