<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Please find below a proposed patch that addresses this bug: <a href="http://public.kitware.com/Bug/view.php?id=15182">
http://public.kitware.com/Bug/view.php?id=15182</a> (FindMPI.cmake fails to properly detect Intel MPI 5.0.1). Because the return code is unreliable for the Intel MPI compile wrappers (e.g.: ‘mpiicpc –showme:compile’), the output text must be interrogated for
possible issues. My choice of “undefined reference” may not be the best choice, but it works for all of my test cases.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have tested this patch with OpenMPI, MPICH2 and Intel MPI on RHEL 6.4 and RHEL 6.4. I have also tested it on Win7 with VS2013 using Microsoft HPC Pack 2008 R2 MPI.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Would anyone like to provide feedback or test this modification? What do I need to do to get this into release code?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-bottom:solid windowtext 1.0pt;padding:0in 0in 1.0pt 0in">
<p class="MsoNormal" style="border:none;padding:0in">-kt<o:p></o:p></p>
</div>
<p class="MsoNormal">Kelly Thompson<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">======================================================================================<o:p></o:p></p>
<p class="MsoNormal">--- a/Modules/FindMPI.cmake<o:p></o:p></p>
<p class="MsoNormal">+++ b/Modules/FindMPI.cmake<o:p></o:p></p>
<p class="MsoNormal">@@ -226,6 +226,13 @@ function (interrogate_mpi_compiler lang try_libs)<o:p></o:p></p>
<p class="MsoNormal"> ERROR_VARIABLE MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE<o:p></o:p></p>
<p class="MsoNormal"> RESULT_VARIABLE MPI_COMPILER_RETURN)<o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">+ # Intel MPI will return a zero return code even when the<o:p></o:p></p>
<p class="MsoNormal">+ # argument to the MPI compiler wrapper is unknown. Attempt to<o:p></o:p></p>
<p class="MsoNormal">+ # catch this case.<o:p></o:p></p>
<p class="MsoNormal">+ if( "${MPI_COMPILE_CMDLINE}" MATCHES "undefined reference" )<o:p></o:p></p>
<p class="MsoNormal">+ set( MPI_COMPILER_RETURN 255 )<o:p></o:p></p>
<p class="MsoNormal">+ endif()<o:p></o:p></p>
<p class="MsoNormal">+<o:p></o:p></p>
<p class="MsoNormal"> if (MPI_COMPILER_RETURN EQUAL 0)<o:p></o:p></p>
<p class="MsoNormal"> # If we appear to have -showme:compile, then we should<o:p></o:p></p>
<p class="MsoNormal"> # also have -showme:link. Try it.<o:p></o:p></p>
<p class="MsoNormal">@@ -264,7 +271,15 @@ function (interrogate_mpi_compiler lang try_libs)<o:p></o:p></p>
<p class="MsoNormal"> RESULT_VARIABLE MPI_COMPILER_RETURN)<o:p></o:p></p>
<p class="MsoNormal"> endif()<o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">+ # Intel MPI will return a zero return code even when the<o:p></o:p></p>
<p class="MsoNormal">+ # argument to the MPI compiler wrapper is unknown. Attempt to<o:p></o:p></p>
<p class="MsoNormal">+ # catch this case.<o:p></o:p></p>
<p class="MsoNormal">+ if( "${MPI_COMPILE_CMDLINE}" MATCHES "undefined reference" )<o:p></o:p></p>
<p class="MsoNormal">+ set( MPI_COMPILER_RETURN 255 )<o:p></o:p></p>
<p class="MsoNormal">+ endif()<o:p></o:p></p>
<p class="MsoNormal">+<o:p></o:p></p>
<p class="MsoNormal"> # MVAPICH uses -compile-info and -link-info. Try them.<o:p></o:p></p>
<p class="MsoNormal">+ # Intel and Cray MPICH2 flavors will likely follow this path.<o:p></o:p></p>
<p class="MsoNormal"> if (NOT MPI_COMPILER_RETURN EQUAL 0)<o:p></o:p></p>
<p class="MsoNormal"> execute_process(<o:p></o:p></p>
<p class="MsoNormal"> COMMAND ${MPI_${lang}_COMPILER} -compile-info<o:p></o:p></p>
<p class="MsoNormal">@@ -378,7 +393,6 @@ function (interrogate_mpi_compiler lang try_libs)<o:p></o:p></p>
<p class="MsoNormal"> # Extract the set of libraries to link against from the link command<o:p></o:p></p>
<p class="MsoNormal"> # line<o:p></o:p></p>
<p class="MsoNormal"> string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")<o:p></o:p></p>
<p class="MsoNormal">-<o:p></o:p></p>
<p class="MsoNormal"> # add the compiler implicit directories because some compilers<o:p></o:p></p>
<p class="MsoNormal"> # such as the intel compiler have libraries that show up<o:p></o:p></p>
<p class="MsoNormal"> # in the showme list that can only be found in the implicit<o:p></o:p></p>
<p class="MsoNormal">@@ -588,6 +602,7 @@ foreach (lang C CXX Fortran)<o:p></o:p></p>
<p class="MsoNormal"> HINTS ${_MPI_BASE_DIR}/bin<o:p></o:p></p>
<p class="MsoNormal"> PATHS ${_MPI_PREFIX_PATH}<o:p></o:p></p>
<p class="MsoNormal"> )<o:p></o:p></p>
<p class="MsoNormal">+<o:p></o:p></p>
<p class="MsoNormal"> interrogate_mpi_compiler(${lang} ${try_libs})<o:p></o:p></p>
<p class="MsoNormal"> mark_as_advanced(MPI_${lang}_COMPILER)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>