[cmake-developers] FindMPI take 2

Alin Marin Elena alinm.elena at gmail.com
Thu Dec 11 05:08:21 EST 2014


Hi Brad,




>> 0001-correctly-detect-MPI-linker-flags-for-Intel-MPI-mayb.patch
>
> Thanks.  That adds a block much like one above it.  Can the preceding
> block be modified to match both -Wl, and -Xlinker?  Something like:
>
> -        string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
> +        string(REGEX MATCHALL "(^| )(-Wl,|-Xlinker )([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
>
> may work (untested).
Indeed the merging of the two sections is the elegant decision... I
kept it in two separate blocks maybe due to my phobia for debugging
regexes.
I have attached a checked patch for linker. flags with the blocks merged.

> The check for whether the CMAKE_<LANG>_COMPILER is already a MPI
> compiler requires a try_compile.  Is there some other way to check
> to see if there is any chance before the full test?
I do not know the answer to this. When I did my changes I tried to
minimise them.


> Also I'm not sure we fully support using a MPI compiler as the main
> compiler.  I can't think of anything that definitely won't work, but
> we don't have nightly testing for the case.
>
> Generally I've viewed the MPI compiler interrogation to be much like
> using pkg-config or $pkg-config tools to get the info needed to use
> a package.  Once that is done then MPI should be treated like any
> other library.
Unfortunately MPI wrapper is abused as main compiler in some projects.
Practically my patch just checks for that. As it involves a pretty
active decision from the user, I think we shall be fine.

> The user should be able to specify MPI_<lang>_COMPILER explicitly.
> Perhaps it could be initialized by ENV{MPICC}, ENV{MPICXX}, and
> ENV{MPIFC} environment variables?  This selection is much like
> picking the primary compiler in the first place.
This will the the best situation but will involve changes to the
FindMPI module that may be above my station to do.

regards,
Alin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Linking-flags-correctly-detected-for-intel-compilers.patch
Type: text/x-diff
Size: 1463 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141211/d872d3c0/attachment.patch>


More information about the cmake-developers mailing list