View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015182CMakeCMakepublic2014-09-30 16:262015-05-04 09:05
ReporterKelly Thompson 
Assigned ToChuck Atkins 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSRed Hat Enterprise LinuxOS Version6.5
Product VersionCMake 3.0 
Target VersionCMake 3.2Fixed in VersionCMake 3.2 
Summary0015182: FindMPI.cmake fails to properly detect Intel MPI 5.0.1
DescriptionThe FindMPI.cmake module queries for include path and link libraries by attempting to use various options (e.g.: -showme:compile) of MPI_${lang}_COMPILER.

      # Check whether the -showme:compile option works. This indicates that we have either OpenMPI
      # or a newer version of LAM-MPI, and implies that -showme:link will also work.
      execute_process(
        COMMAND ${MPI_${lang}_COMPILER} -showme:compile
        OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
        ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
        RESULT_VARIABLE MPI_COMPILER_RETURN)

For Intel MPI, MPI_CXX_COMPILER has the value 'mpiicpc.' The command 'mpiicpc -showme:compile' fails, but returns a '0' error code:

% mpiicpc -showme:comple; echo $?
icpc: command line warning #10006: ignoring unknown option '-showme:comple'
/var/lib/perceus/vnfs/asc-fe/rootfs/usr/bin/../lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
0

I have contacted Intel support and they confirmed that this is by design. Unknown compiler options are considered to be warnings, not errors.

This issue can be fixed by adding more complex logic to test the error state of the 'mpiicpc -showme:compile' command. In my local install of CMake, I added the following logic:

  if( "${MPI_COMPILE_CMDLINE}" MATCHES "undefined reference")
    set( MPI_COMPILER_RETURN 255 )
  endif()

This appears to solve the problem of incorrect information being saved in MPI_LINK_CMDLINE, MPI_INCDIRS, and MPI_LIBDIRS.
Steps To ReproduceBefore running cmake, I needed to set these environment variables:

export CXX=`which mpiicpc`
export CC=`which mpiicc`
export MPIEXEC=`which srun`

So that FindMPI would query the correct MPI compile wrappers.

See bug description for more details.
Additional InformationI can reproduce this issue with Intel MPI 5.0.1 and Intel MPI 4.1.3 on two different systems (RHEL 6.4 and RHEL 6.5)
TagsNo tags attached.
Attached Filesdiff file icon doublecheckerror.diff [^] (3,882 bytes) 2014-12-04 13:51 [Show Content]
diff file icon usecompilerewrapper.diff [^] (892 bytes) 2014-12-04 14:01 [Show Content]
patch file icon 0001-FindMPI-Factor-out-compiler-wrapper-execution-into-h.patch [^] (3,787 bytes) 2014-12-04 14:17 [Show Content]
patch file icon 0002-FindMPI-Workaround-Intel-MPI-5.0.1-exit-code-problem.patch [^] (1,470 bytes) 2014-12-04 14:17 [Show Content]
diff file icon linkflags.diff [^] (2,284 bytes) 2014-12-04 17:23 [Show Content]

 Relationships
related to 0014991closedKitware Robot FindMPI doesn't pass compiler flags to $MPICC -show. Finds wrong libraries for Xeon Phi native mode. 

  Notes
(0037044)
Arch D. Robison (reporter)
2014-10-17 15:28

I ran into this issue with Intel MPI 5.0.1 and RHEL 7.0.
(0037054)
Brad King (manager)
2014-10-20 09:31

Currently there is no maintainer for the FindMPI module:

 http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]
(0037108)
Brad King (manager)
2014-10-30 12:26

For reference, here is a mailing list thread with Kelly's proposed patch:

 Proposed patch for FindMPI.cmake (Intel MPI)
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/11466 [^]
(0037374)
Brad King (manager)
2014-12-04 08:41

Another mailing list thread about this:

 FindMPI and Intel MPI
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/11823 [^]
(0037377)
RolandSchulz (reporter)
2014-12-04 09:30

This has been fixed in Intel MPI 5.0.2
(0037380)
Alin M Elena (reporter)
2014-12-04 11:06

Indeed 5.0.2 seems to have no issue in finding the correct c++ and c details... only fortran fails...

Maybe I shall open a separate bug?
(0037381)
Brad King (manager)
2014-12-04 11:22

Re 0015182:0037380: No separate issue needed. The FindMPI module may need a change for this issue regardless of to which language it applies.

Even if upstream Intel MPI is fixed it would be nice to support the broken versions if possible anyway. The thread linked in 0015182:0037108 has a patch and my review of it. That would be a good starting point for continuing work on a workaround.
(0037383)
Alin M Elena (reporter)
2014-12-04 13:49

There are three issues I see

1. Failure to detect undefined reference. I attached patch based on KT and Brad suggestions.
2. Failure to use the wrapper as a compiler and skip the detection via interrogation.
3. Using wrong wrappers to interrogate for intel mpi and intel compilers. eg. mpif90 instead of mpiifort (NB: If a user uses I_MPI_F90=ifort, or c/c++ equivalents this issue is gone, but I think we shall not rely on user.)
(0037384)
Alin M Elena (reporter)
2014-12-04 13:52

the patch I have spoken above is doublecheckerror.diff
(0037385)
Alin M Elena (reporter)
2014-12-04 14:01

patch for issue 2. usecompilerewrapper.diff
shall be applied after first patch.
(0037386)
Brad King (manager)
2014-12-04 14:18

Re 0015182:0037384: Thanks. I've factored the first patch out into:

 0001-FindMPI-Factor-out-compiler-wrapper-execution-into-h.patch
 0002-FindMPI-Workaround-Intel-MPI-5.0.1-exit-code-problem.patch

with some minor revisions. Please test these.
(0037391)
Alin M Elena (reporter)
2014-12-04 16:28

Thanks Brad! Tested it seems to work, fixes issue 1.
now we are ready for issue 2.
and one more issue.

4. the linker information is not parsed, see below


-- MPI_C_INCLUDE_PATH /ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/include
-- MPI_C_LINK_FLAGS
-- MPI_C_LIBRARIES /ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/lib/libmpifort.so;/ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/lib/release/libmpi.so;/ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/lib/libmpigi.a;/usr/lib64/libdl.so;/usr/lib64/librt.so;/usr/lib64/libpthread.so
-- Configuring done
-- Generating done
-- Build files have been written to: /ichec/home/staff/alin/findmpi/5.0.1
[alin@fionn2:~/findmpi/5.0.1]: mpicc -compile-info
gcc -I/ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/include -L/ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/lib/release -L/ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/lib -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker /ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/lib/release -Xlinker -rpath -Xlinker /ichec/packages/intel/intel-cluster-studio-2015/impi_5.0.1/intel64/lib -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/5.0/intel64/lib/release -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/5.0/intel64/lib -lmpifort -lmpi -lmpigi -ldl -lrt -lpthread
(0037392)
Alin M Elena (reporter)
2014-12-04 17:22

patch for issue 4 (2 too) linkflags.diff
(0037394)
Brad King (manager)
2014-12-05 09:20

Re 0015182:0037391: Thanks for testing. I've integrated the first round of patches:

 FindMPI: Factor out compiler wrapper execution into helper
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f5ede300 [^]

 FindMPI: Workaround Intel MPI 5.0.1 exit code problem
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7626c8dc [^]
(0037395)
Brad King (manager)
2014-12-05 09:28

Re 0015182:0037392: Thanks. I think these other fixes may take a few iterations so let's move discussion back to the dev list. Please use Git to create a commit and "git format-patch" to construct a patch with author/date/message/etc. and send to the list.
(0037403)
Brad King (manager)
2014-12-08 09:01

I'm resolving this issue because the originally reported problem has been addressed. Alin, please bring remaining patches to the developer mailing list as requested in 0015182:0037395.
(0038694)
Robert Maynard (manager)
2015-05-04 09:05

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-09-30 16:26 Kelly Thompson New Issue
2014-10-17 15:28 Arch D. Robison Note Added: 0037044
2014-10-20 09:31 Brad King Note Added: 0037054
2014-10-30 12:25 Brad King Assigned To => Chuck Atkins
2014-10-30 12:25 Brad King Status new => assigned
2014-10-30 12:26 Brad King Note Added: 0037108
2014-10-30 12:26 Brad King Target Version => CMake 3.2
2014-12-04 08:41 Brad King Note Added: 0037374
2014-12-04 09:30 RolandSchulz Note Added: 0037377
2014-12-04 11:06 Alin M Elena Note Added: 0037380
2014-12-04 11:22 Brad King Note Added: 0037381
2014-12-04 13:49 Alin M Elena Note Added: 0037383
2014-12-04 13:51 Alin M Elena File Added: doublecheckerror.diff
2014-12-04 13:52 Alin M Elena Note Added: 0037384
2014-12-04 14:01 Alin M Elena Note Added: 0037385
2014-12-04 14:01 Alin M Elena File Added: usecompilerewrapper.diff
2014-12-04 14:17 Brad King File Added: 0001-FindMPI-Factor-out-compiler-wrapper-execution-into-h.patch
2014-12-04 14:17 Brad King File Added: 0002-FindMPI-Workaround-Intel-MPI-5.0.1-exit-code-problem.patch
2014-12-04 14:18 Brad King Note Added: 0037386
2014-12-04 16:28 Alin M Elena Note Added: 0037391
2014-12-04 17:22 Alin M Elena Note Added: 0037392
2014-12-04 17:23 Alin M Elena File Added: linkflags.diff
2014-12-05 09:20 Brad King Note Added: 0037394
2014-12-05 09:28 Brad King Note Added: 0037395
2014-12-05 13:18 Brad King Relationship added related to 0014991
2014-12-08 09:01 Brad King Note Added: 0037403
2014-12-08 09:01 Brad King Status assigned => resolved
2014-12-08 09:01 Brad King Resolution open => fixed
2014-12-08 09:01 Brad King Fixed in Version => CMake 3.2
2015-05-04 09:05 Robert Maynard Note Added: 0038694
2015-05-04 09:05 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team