<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks for the suggestions, everyone. I'm finally taking a look at fixing FindMPI.<div><br></div><div>So far, I've added a couple extra interrogations to look for -compile-info and -link-info on newer versions of mvapich, and I'm finally getting around to figuring out what variables need to be set.</div><div><br></div><div>I intend to separate the compiler interrogation part of the script out into a function, so I can call it for per-language compilers. I've actually already done something like this for autoconf. I think the final version will end up structured something like that; here's the m4 if you're interested:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://github.com/tgamblin/libra/blob/master/m4/lx_find_mpi.m4">https://github.com/tgamblin/libra/blob/master/m4/lx_find_mpi.m4</a></div><div><br></div><div>Ok, now the details. Here are variables set by the current version of FindMPI:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">MPI_FOUND<br>MPI_COMPILER<br>MPI_COMPILE_FLAGS<br>MPI_INCLUDE_PATH<br>MPI_LINK_FLAGS<br>MPI_LIBRARY<br>MPI_EXTRA_LIBRARY<br>MPI_LIBRARIES<br>MPIEXEC<br>MPIEXEC_NUMPROC_FLAG<br>MPIEXEC_PREFLAGS<br>MPIEXEC_POSTFLAGS</blockquote><div><div><br></div><div>Observations and questions:</div><div><br></div><div>1. For supporting multiple languages, the MPIEXEC flags shouldn't need to change, so I'll leave those as they are. Correct me if I'm wrong.</div><div><br></div><div>2. Instead of searching just for MPI_COMPILER, I'm going to search for MPI_C_COMPILER, MPI_CXX_COMPILER, and MPI_Fortran_COMPILER, then interrogate each separately. I guess I'll set MPI_COMPILER to the CXX compiler if that was found, and the C compiler if not, and leave it unset if neither were found. I believe this should take care of any backward compatibility issues.</div><div><br></div><div>3. How is the "Fortran" language handled in CMake? What version of Fortran are all the other variables labeled "Fortran" supposed to represent? Should the MPI_Fortran_COMPILER search look for F95 compilers, then F90, then F77? Or should F77 and F90 be separate? If they're separate, how do you do this?</div><div><br></div><div>4. MPI_FOUND, MPI_COMPILER, MPI_COMPILE_FLAGS, MPI_INCLUDE_PATH, MPI_LINK_FLAGS, MPI_LIBRARIES, MPI_EXTRA_LIBRARY, and MPI_LIBRARY will become MPI_<LANG>_FOUND, MPI_<LANG>_COMPILER, etc.</div><div><br></div><div>5. What is the point of having MPI_LIBRARIES, MPI_LIBRARY and MPI_EXTRA_LIBRARY? The latter two seem completely unnecessary. Are there even builds that check for these, or that try to link against *just* MPI_LIBRARY? What am I missing? I suppose I need to keep these for backward compatibility, but I'd love to rewrite the interrogation part so that it just sets MPI_LIBRARIES, then I could parse that later to set the other two for backward compatibility.</div><div><br></div><div>Thoughts? Answers and suggestions would be much appreciated.</div><div><br></div><div>Thanks!</div><div>-Todd</div><div><br></div><div><br></div><div><br></div></div><div><br></div><div><br><div><br></div><div><br></div><div><br><div><div>On Dec 20, 2010, at 6:09 AM, Marcel Loose wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On 19-12-2010 at 0:04, in message<br></blockquote></blockquote></blockquote><<a href="mailto:A43E19D1-AF96-4935-99FD-705A4CDA7E34@llnl.gov">A43E19D1-AF96-4935-99FD-705A4CDA7E34@llnl.gov</a>>, Todd Gamblin<br><<a href="mailto:tgamblin@llnl.gov">tgamblin@llnl.gov</a>> wrote: <br><blockquote type="cite">Hey all,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This has been brought up before (sort of) here:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/26533">http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/26533</a><br><blockquote type="cite"><br></blockquote><blockquote type="cite">FindMPI doesn't currently give you the libraries, includes, etc. for<br></blockquote><br><blockquote type="cite">different languages. MPI compilers can (and typically do) have<br></blockquote>different <br><blockquote type="cite">includes/libraries depending on the language you're using. It was<br></blockquote>noted <br><blockquote type="cite">above that you don't get the fortran libraries for MPI using the<br></blockquote>current <br><blockquote type="cite">macro. Another problem with the current setup is that you're also<br></blockquote>likely to <br><blockquote type="cite">inadvertently get the C++ includes with the current FindMPI, unless<br></blockquote>you <br><blockquote type="cite">explicitly disable them using things like -DOMPI_SKIP_MPICXX. This<br></blockquote>can get <br><blockquote type="cite">you unwanted C++ symbols in your MPI libraries (because the MPI C++<br></blockquote>interface <br><blockquote type="cite">and headers suck, but that's a whole different story).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'd be interested in fixing this. But I would like guidance on how<br></blockquote>to do <br><blockquote type="cite">it. My inclination would be to make a new version that gives you not<br></blockquote>just <br><blockquote type="cite">MPI_FOUND, MPI_LIBRARIES, etc.. but MPI_<LANG>_FOUND,<br></blockquote>MPI_<LANG>_LIBRARIES, <br><blockquote type="cite">MPI_<LANG>_INCLUDE_PATH, etc. If you read the thread above, someone<br></blockquote>suggested <br><blockquote type="cite">using components for this back in January, but that was left on the<br></blockquote>table and <br><blockquote type="cite">seems not to have been implemented.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">What's the best way to implement proper language support in the<br></blockquote>FindMPI <br><blockquote type="cite">module?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-Todd<br></blockquote><br>Hi Todd,<br><br>I think this is a good idea. You might consider taking into account<br>which languages are currently enabled, either explicitly with<br>enable_language() or implicitly with project().<br><br>Best regards,<br>Marcel Loose.<br><br><br><br>-- <br>Marcel Loose<br>Senior Software Engineer, Computing Group R&D, Astron, the Netherlands<br><br></div></blockquote></div><br></div></div></body></html>