FindMPI + Intel 19 compilers: MPI C/CXX not found
Script to reproduce the problem:
cmake_minimum_required (VERSION 3.8.2)
project (Test C CXX Fortran)
find_package(MPI)
When using Intel 19 compilers, find_package(MPI)
produces:
-- Could NOT find MPI_C (missing: MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
-- Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND) (found version "3.1")
I print the following:
-- MPI_C_FOUND=FALSE
-- MPI_CXX_FOUND=FALSE
-- MPI_Fortran_FOUND=TRUE
- This happens only when using
cmake>=3.10
. Withcmake<=3.9
, MPI C/CXX are found. - Another thing I noticed is this happens when the OS is Ubuntu 17.10 or 18.04. I do not see this problem on RedHat 6, 7 or on Debian 9.
- Not sure if it matters, but I also tried with
cmake_minimum_required (VERSION 3.11)
- Manually passing
MPI_C_LIBRARIES
orMPI_CXX_LIBRARIES
did not help either.
my cmake command: cmake .. -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort
Output of icc -v
icc version 19.0.0.117 (gcc version 8.2.0 compatibility)
- gcc used by Intel compiler driver is installed either manually or using Spack on the different OS tested. When using the default gcc provided by Ubuntu, this problem of not finding MPI C/CXX does not show up.
Edited by Ajay Panyala