[CMake] FindMPI
Zaak Beekman
zbeekman at gmail.com
Mon Nov 28 10:09:27 EST 2016
Thanks for the additional pointers Chuck! I am aware that it is preferred
practice to pass the actual compilers rather than the wrappers as FC etc.
but per Brad's advice I think Damian had setup the OpenCoarrays CMake build
system to accept FC=mpif90 etc. and I'm in the process of migrating to the
more normal FC=gfortran etc. approach but I don't want users who use the
old method to get caught out. I'll try setting MPI_{C,etc.}_COMPILER
(rather than MPI_HOME) before calling `find_package(MPI)` and see if that
works as well as setting MPI_HOME does.
Thanks for the tips!
On Mon, Nov 28, 2016 at 10:02 AM Chuck Atkins <chuck.atkins at kitware.com>
wrote:
> Hi Zaak,
>
> When using CMake, it's generally best to use the actual compiler rather
> than any compiler wrappers (with Cray being the exception). Given that,
> set the CC, CXX, and FC environment variables to the actual compilers you
> want to use and then the MPI_{C,CXX,Fortan}_COMPILER CMake variables the
> MPI wrappers. FindMPI will then interrogate the MPI wrappers to extract
> the appropriate include and link options.
>
> ----------
> Chuck Atkins
> Staff R&D Engineer, Scientific Computing
> Kitware, Inc.
>
>
> On Mon, Nov 28, 2016 at 9:58 AM, Chuck Atkins <chuck.atkins at kitware.com>
> wrote:
>
> Pass the following CMake options at configure time:
>
> -DMPI_C_COMPILER=/path/to/mpicc
> -DMPI_CXX_COMPILER=/path/to/mpiCC
> -DMPI_Fortran_COMPILER=/path/to/mpif90
>
> ----------
> Chuck Atkins
> Staff R&D Engineer, Scientific Computing
> Kitware, Inc.
>
>
> On Wed, Nov 23, 2016 at 6:05 PM, Zaak Beekman <zbeekman at gmail.com> wrote:
>
> Hi,
>
> I want to be able to pass FC=mpif90 (or FC=$(which mpif90)) and CC=mpicc
> etc. OR also be able to pass a compiler and use FindMPI to add link,
> compile and include flags. I'm encountering an issue when my MPI
> implementation is not on my PATH, I want CMake to be able to look in an
> additional location (our build script can download and build MPICH and by
> default installs it in user space) and also resolve where mpif90 is coming
> from and look there too.
>
> Whats the correct way to pass HINTS or PATHS to FindMPI? i.e., how do I
> specify additional locations to search?
>
> Using `find_package` with HINTS and PATHS means that it doesn't use
> FindMPI. I also tried setting CMAKE_SYSTEM PREFIX_PATH, but I think that's
> a cache variable set early, so it's not having an effect.
>
> It would be great if FindMPI used the realpath of mpif90 etc when passed
> as $FC.
>
> TIA
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161128/66e30ba0/attachment.html>
More information about the CMake
mailing list