# FindMPI.cmake with Cray PE wrappers+Intel compiler

**URL:** https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004
**Category:** Usage
**Created:** [December 1, 2022, 9:27pm UTC](https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004 "2022-12-01T21:27:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AlexanderRichertNOAA](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alexanderrichertnoaa/32/2974_2.png) [@AlexanderRichertNOAA](https://discourse.cmake.org/u/AlexanderRichertNOAA)
#### Post date: [December 1, 2022, 9:27pm UTC](https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004/1 "2022-12-01T21:27:23Z")

</div>

I’m having some difficulty getting FindMPI.cmake to recognize Cray MPICH when using the Cray PE wrappers for the Intel compilers (Cray wrappers with Cray compilers is not a problem). It seems that the file assumes that Cray wrapper implies Cray compiler. I can get a little closer to working if I set MPI\_C\_COMPILER, but it still fails on account of include dirs not being found. As far as I know, when the cray-mpich env module is loaded, the wrappers have everything needed to compile with MPI, so I don’t think library/include directories should be needed. Is there some way I can convince FindMPI.cmake to not care about finding anything other than the executables?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [December 7, 2022, 12:07am UTC](https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004/2 "2022-12-07T00:07:41Z")

</div>

I suspect that the @chuckatkins ping that would be most useful here is a dead end now. But maybe not…

---

<div class="post-metadata">

### Author: ![jrobcary](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@jrobcary](https://discourse.cmake.org/u/jrobcary)
#### Post date: [March 2, 2024, 4:14pm UTC](https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004/3 "2024-03-02T16:14:15Z")

</div>

@ AlexanderRichertNOAA, did you ever find a solution? I am trying to use the Cray compiler wrappers with GCC, and it always ends with

Could NOT find MPI\_C (missing: MPI\_C\_WORKS)

My modules are

1. craype-x86-milan
2. libfabric/1.15.2.0
3. craype-network-ofi
4. xpmem/2.6.2-2.5\_2.38\_\_gd067c3f.shasta
5. PrgEnv-gnu/8.5.0
6. cray-dsmml/0.2.2
7. craype/2.7.30
8. perftools-base/23.12.0
9. cpe/23.12
10. craype-accel-nvidia80
11. gpu/1.0
12. gcc/11.2.0 (c)
13. cudatoolkit/12.2 (g)
14. cray-libsci/23.02.1.1 (math)

My configure line is

‘/global/cfs/cdirs/txsupp/vp13usrs/perlmutter/contrib-gcc1120/cmake-3.28.3-ser/bin/cmake’   
-DCMAKE\_INSTALL\_PREFIX:PATH=/global/cfs/cdirs/txsupp/vp13usrs/perlmutter/contrib-gcc1120/hdf5-1.12.1-par   
-DCMAKE\_BUILD\_TYPE:STRING=Release   
-DCMAKE\_COLOR\_MAKEFILE:BOOL=FALSE   
-DCMAKE\_VERBOSE\_MAKEFILE:BOOL=TRUE   
-DHDF5\_ENABLE\_PARALLEL:BOOL=ON   
-DBUILD\_SHARED\_LIBS:BOOL=OFF   
-DHDF5\_BUILD\_TOOLS:BOOL=ON   
-DHDF5\_BUILD\_HL\_LIB:BOOL=ON   
-DCMAKE\_C\_COMPILER:FILEPATH=‘/opt/cray/pe/craype/2.7.30/bin/cc’   
-DCMAKE\_CXX\_COMPILER:FILEPATH=‘/opt/cray/pe/craype/2.7.30/bin/CC’   
-DCMAKE\_Fortran\_COMPILER:FILEPATH=‘/opt/cray/pe/craype/2.7.30/bin/ftn’   
-DCMAKE\_C\_FLAGS:STRING=‘-pipe -fPIC’   
-DCMAKE\_CXX\_FLAGS:STRING=‘-pipe -fPIC’   
-DCMAKE\_Fortran\_FLAGS:STRING=‘-pipe -fPIC’   
-DMPI\_C=‘/opt/cray/pe/craype/2.7.30/bin/cc’   
-DHDF5\_BUILD\_FORTRAN:BOOL=ON   
-DHDF5\_ENABLE\_Z\_LIB\_SUPPORT:BOOL=ON   
-DHDF5\_BUILD\_CPP\_LIB:BOOL=‘OFF’   
/pscratch/sd/c/user/builds-perlmutter-gcc/vxsimall-gcc/hdf5-1.12.1

An even simpler CMakeLists.txt fails to configure on the Cary

cary@login04/…/cmaketest$ cat CMakeLists.txt

# Set policies

include(${CMAKE\_SOURCE\_DIR}/scimake/SciPolicies.cmake NO\_POLICY\_SCOPE)  
cmake\_policy(SET CMP0105 OLD)  
cmake\_policy(SET CMP0057 NEW)  
include(CheckLanguage)  
project(cmaketest)  
find\_package(MPI REQUIRED)

---

<div class="post-metadata">

### Author: ![liu15](https://discourse.cmake.org/user_avatar/discourse.cmake.org/liu15/32/5079_2.png) [@liu15](https://discourse.cmake.org/u/liu15)
#### Post date: [November 1, 2024, 8:27pm UTC](https://discourse.cmake.org/t/findmpi-cmake-with-cray-pe-wrappers-intel-compiler/7004/4 "2024-11-01T20:27:40Z")

</div>

I thought that setting the compiler id to “unknown” should have resolved this without adding Cray compiler flags, but FindMPI can’t find the right wrapper.

I was looking through FindMPI and it looks like it sets the Cray compiler “wrapper” names, just like it sets it for the other platforms ( [CMake/Modules/FindMPI.cmake at master · Kitware/CMake](https://github.com/Kitware/CMake/blob/master/Modules/FindMPI.cmake#L342).

The subsequent comment indicates that if we don’t match the compiler type it should attempt all the compiler wrappers ( [CMake/Modules/FindMPI.cmake at master · Kitware/CMake](https://github.com/Kitware/CMake/blob/master/Modules/FindMPI.cmake#L355), but CRAY is not in this list.

Is this a bug or is this because the CRAY “wrappers” match the default (serial) compiler names on other systems?
