FindMPI.cmake with Cray PE wrappers+Intel compiler

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?

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

@ 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)

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.

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, 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?