<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>That's good to know -- it looks like that capability was added 3 months after we wrote our CMakeLists.txt and we had to skip the find_package if we used a cray. That was 2011 and we never looked back at it because it worked. <br><br>I guess I can go ahead and update that!<br><br>Tim<br><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Chuck Atkins" <chuck.atkins@kitware.com><br><b>To: </b>"tim gallagher" <tim.gallagher@gatech.edu><br><b>Cc: </b>"Andreas Naumann" <Andreas-Naumann@gmx.net>, cmake@cmake.org<br><b>Sent: </b>Wednesday, September 9, 2015 11:11:27 AM<br><b>Subject: </b>Re: [CMake] CMake + MPI<br><br><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The only exception to that (which I am aware of) is if you are on a CRAY system where the MPI (and BLAS and LAPACK) are baked into the compiler wrappers (cc, ftn, etc). In those situations, you actually do not want to run find_package(MPI) or it will throw errors.<br></blockquote><div><br></div></div>Not true.  The FindMPI.cmake module performs the appropriate introspection to check if your primary compiler wraps accordingly.  For example, on a Cray XC30, with the PrgEnv-pgi and cray-mpich modules loaded:<br><span style="font-family:monospace,monospace"><br>p02064@swan:~/Code/tmp/build> cat ../source/CMakeLists.txt <br>cmake_minimum_required(VERSION 3.3)<br>project(TestMPI C CXX)<br><br>find_package(MPI REQUIRED)<br><br>add_executable(test-mpi-c test-mpi.c)<br>target_include_directories(test-mpi-c PRIVATE ${MPI_C_INCLUDE_PATH})<br>target_link_libraries(test-mpi-c ${MPI_C_LIBRARIES})<br><br>add_executable(test-mpi-cxx test-mpi.cxx)<br>target_include_directories(test-mpi-cxx PRIVATE ${MPI_CXX_INCLUDE_PATH})<br>target_link_libraries(test-mpi-cxx ${MPI_CXX_LIBRARIES})</span><br><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace">p02064@swan:~/Code/tmp/build></span></span><br><br>p02064@swan:~/Code/tmp/build> cmake ../source<br>-- The C compiler identification is PGI 15.7.0<br>-- The CXX compiler identification is PGI 15.7.0<br>-- Check for working C compiler: /opt/cray/craype/2.4.1/bin/cc<br>-- Check for working C compiler: /opt/cray/craype/2.4.1/bin/cc -- works<br>-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>-- Check for working CXX compiler: /opt/cray/craype/2.4.1/bin/CC<br>-- Check for working CXX compiler: /opt/cray/craype/2.4.1/bin/CC -- works<br>-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>-- Found MPI_C: /opt/cray/craype/2.4.1/bin/cc  <br>-- Found MPI_CXX: /opt/cray/craype/2.4.1/bin/CC  <br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to: /home/users/p02064/Code/tmp/build<br></span><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace">p02064@swan:~/Code/tmp/build></span><br><br>p02064@swan:~/Code/tmp/build> grep '^MPI_.*' CMakeCache.txt | grep -v INTERNAL<br>MPI_CXX_COMPILER:STRING=/opt/cray/craype/2.4.1/bin/CC<br>MPI_CXX_COMPILE_FLAGS:STRING=<br>MPI_CXX_INCLUDE_PATH:STRING=<br>MPI_CXX_LIBRARIES:STRING=<br>MPI_CXX_LINK_FLAGS:STRING=<br>MPI_CXX_NO_INTERROGATE:STRING=/opt/cray/craype/2.4.1/bin/CC<br>MPI_C_COMPILER:STRING=/opt/cray/craype/2.4.1/bin/cc<br>MPI_C_COMPILE_FLAGS:STRING=<br>MPI_C_INCLUDE_PATH:STRING=<br>MPI_C_LIBRARIES:STRING=<br>MPI_C_LINK_FLAGS:STRING=<br>MPI_C_NO_INTERROGATE:STRING=/opt/cray/craype/2.4.1/bin/cc<br>MPI_EXTRA_LIBRARY:STRING=MPI_EXTRA_LIBRARY-NOTFOUND<br>MPI_LIBRARY:FILEPATH=MPI_LIBRARY-NOTFOUND</span><br><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace"></span>p02064@swan:~/Code/tmp/build><br><br></span>p02064@swan:~/Code/tmp/build> make<br>[ 25%] Building C object CMakeFiles/test-mpi-c.dir/test-mpi.c.o<br>[ 50%] Linking C executable test-mpi-c<br>[ 50%] Built target test-mpi-c<br>[ 75%] Building CXX object CMakeFiles/test-mpi-cxx.dir/test-mpi.cxx.o<br>[100%] Linking CXX executable test-mpi-cxx<br>[100%] Built target test-mpi-cxx<br>p02064@swan:~/Code/tmp/build> </span><br><br></div><div class="gmail_extra">As you can see from the resulting cache, the FindMPI module knows how to act accordingly even when mpi libraries are folded into the regular compiler.<br></div></div>
</div><br></div></body></html>