I have attached a simplified source code and demonstration script
to show an OpenMP bug in the Intel Fortran compiler. I am using
/soft/compilers/intel_beta/compilers_and_libraries_2017.0.042/linux/bin/intel64/ifort
The bug occurs on both the jlse login node and knl00. It
occurs using two or more OpenMP threads, but not if only
one thread is used. The demonstration uses no optimization
(O0) but the bug also happens with optimization.
It does not happen on the IBM BG/Q.
The bug is a segfault at line 113 of the source file:
!$OMP PARALLEL WORKSHARE
cof(:,:,1:min(2,num_op_emew),:,:) = 0
cfcl(:,:,:,:) = 0.d0
!$OMP END PARALLEL WORKSHARE
It is triggered by line 128 when that line is activated (in the
source file it is commented):
cof(:,:,2,iqcross(:),1) = cof(:,:,1,iqcross(:),1) + cof(:,:,2,iqcross(:),1)
The problem is the index iqcross(:); iqcross is a 2-element array
with valid values as are printed. If this line is replaced by
the equivalent two lines that follow:
cof(:,:,2,iqcross(1),1) = cof(:,:,1,iqcross(1),1) + cof(:,:,2,iqcross(1),1)
cof(:,:,2,iqcross(2),1) = cof(:,:,1,iqcross(2),1) + cof(:,:,2,iqcross(2),1)
no segfault occurs. Note also that in fact this section of the
code will never be reached due to the stop at line 119 and the if at
line 121 which is false. In the original large code, this
second OMP section was more than 100 lines removed from the first
with a large intermediate OMP section.
The script first compiles and runs the source with the commented
line (bug-ok.f). This shows that things work with the line removed.
Then the script uses sed to uncomment the line into bug-bad.f and
compiles and runs that. This causes the segfault.
Steve
--
Steven C. Pieper, Senior Physicist Emeritus: spieper@anl.gov
Argonne National Laboratory, Physics Division, Bldg. 203, Argonne, IL 60439
Phone: 630-252-4232 Fax -6008 Secretary, Debra Beres, -4100
http://www.phy.anl.gov/theory/staff/scp.html