FindMPI not setting up Intel MPI when used with Intel Compiler; works with GCC
Greetings:
Take the following minimal cmake script with diagnostics:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(findmpi C CXX)
# -------------------------------------------------------------------------------MPI--
message(STATUS "MPI_INCLUDE_PATH : ${MPI_INCLUDE_PATH}")
message(STATUS "MPI_LIBRARIES : ${MPI_LIBRARIES}")
message(STATUS "MPI_CXX_INCLUDE_PATH : ${MPI_CXX_INCLUDE_PATH}")
message(STATUS "MPI_CXX_INCLUDE_DIRS : ${MPI_CXX_INCLUDE_DIRS}")
message(STATUS "MPI_CXX_LIBRARIES : ${MPI_CXX_LIBRARIES}")
message(STATUS "MPI_CXX_FOUND : ${MPI_CXX_FOUND}")
message(STATUS "MPI_C_FOUND : ${MPI_C_FOUND}")
message(STATUS "MPI_C_INCLUDE_DIRS : ${MPI_C_INCLUDE_DIRS}")
message(STATUS "MPI_C_COMPILER : ${CMAKE_C_COMPILER}")
message(STATUS "MPI_C_INCLUDE_PATH : ${MPI_C_INCLUDE_PATH}")
message(STATUS "MPI_C_LIBRARIES : ${MPI_C_LIBRARIES}")
find_program(MPIEXEC_EXECUTABLE "mpiexec")
find_package(MPI REQUIRED)
message(STATUS "MPI_INCLUDE_PATH : ${MPI_INCLUDE_PATH}")
message(STATUS "MPI_LIBRARIES : ${MPI_LIBRARIES}")
message(STATUS "MPI_CXX_INCLUDE_PATH : ${MPI_CXX_INCLUDE_PATH}")
message(STATUS "MPI_CXX_INCLUDE_DIRS : ${MPI_CXX_INCLUDE_DIRS}")
message(STATUS "MPI_CXX_LIBRARIES : ${MPI_CXX_LIBRARIES}")
message(STATUS "MPI_CXX_FOUND : ${MPI_CXX_FOUND}")
message(STATUS "MPI_C_FOUND : ${MPI_C_FOUND}")
message(STATUS "MPI_C_INCLUDE_DIRS : ${MPI_C_INCLUDE_DIRS}")
message(STATUS "MPI_C_COMPILER : ${CMAKE_C_COMPILER}")
message(STATUS "MPI_C_INCLUDE_PATH : ${MPI_C_INCLUDE_PATH}")
message(STATUS "MPI_C_LIBRARIES : ${MPI_C_LIBRARIES}")
If you build with GCC, it finds everything correctly:
sh
sh-4.2$ mkdir build
sh-4.2$ cd build
sh-4.2$ source /opt/intel/impi/2018.3.222/intel64/bin/mpivars.sh intel64
sh-4.2$ source /opt/intel/compilers_and_libraries_2018.3.222/linux/tbb/bin/tbbvars.sh intel64
sh-4.2$ export PATH=/nfs/pdx/home/cwcongdo/Downloads/cmake-3.12.2-Linux-x86_64/bin:$PATH
sh-4.2$ cmake -D CMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- MPI_INCLUDE_PATH :
-- MPI_LIBRARIES :
-- MPI_CXX_INCLUDE_PATH :
-- MPI_CXX_INCLUDE_DIRS :
-- MPI_CXX_LIBRARIES :
-- MPI_CXX_FOUND :
-- MPI_C_FOUND :
-- MPI_C_INCLUDE_DIRS :
-- MPI_C_COMPILER : /usr/bin/cc
-- MPI_C_INCLUDE_PATH :
-- MPI_C_LIBRARIES :
-- Found MPI_C: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/release_mt/libmpi.so (found version "3.1")
-- Found MPI_CXX: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/libmpicxx.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- MPI_INCLUDE_PATH : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/include
-- MPI_LIBRARIES : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/libmpicxx.so;/opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/release_mt/libmpi.so;/opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/libmpigi.a;/usr/lib64/libdl.so;/usr/lib64/librt.so;/usr/lib64/libpthread.so
-- MPI_CXX_INCLUDE_PATH : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/include
-- MPI_CXX_INCLUDE_DIRS : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/include
-- MPI_CXX_LIBRARIES : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/libmpicxx.so;/opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/release_mt/libmpi.so;/opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/libmpigi.a;/usr/lib64/libdl.so;/usr/lib64/librt.so;/usr/lib64/libpthread.so
-- MPI_CXX_FOUND : TRUE
-- MPI_C_FOUND : TRUE
-- MPI_C_INCLUDE_DIRS : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/include
-- MPI_C_COMPILER : /usr/bin/cc
-- MPI_C_INCLUDE_PATH : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/include
-- MPI_C_LIBRARIES : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/release_mt/libmpi.so;/opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/lib/libmpigi.a;/usr/lib64/libdl.so;/usr/lib64/librt.so;/usr/lib64/libpthread.so
-- Configuring done
-- Generating done
-- Build files have been written to: /nfs/pdx/home/cwcongdo/RELION/relion/build
sh-4.2$
But if you build with ICC, it does not:
sh
sh-4.2$ mkdir build
sh-4.2$ cd build
sh-4.2$ source /opt/intel/compilers_and_libraries_2018.3.222/linux/bin/compilervars.sh intel64
sh-4.2$ export PATH=/nfs/pdx/home/cwcongdo/Downloads/cmake-3.12.2-Linux-x86_64/bin:$PATH
sh-4.2$ CC=mpiicc CXX=mpiicpc cmake -D CMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is Intel 18.0.3.20180410
-- The CXX compiler identification is Intel 18.0.3.20180410
-- Check for working C compiler: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicc
-- Check for working C compiler: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicpc
-- Check for working CXX compiler: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicpc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- MPI_INCLUDE_PATH :
-- MPI_LIBRARIES :
-- MPI_CXX_INCLUDE_PATH :
-- MPI_CXX_INCLUDE_DIRS :
-- MPI_CXX_LIBRARIES :
-- MPI_CXX_FOUND :
-- MPI_C_FOUND :
-- MPI_C_INCLUDE_DIRS :
-- MPI_C_COMPILER : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicc
-- MPI_C_INCLUDE_PATH :
-- MPI_C_LIBRARIES :
-- Found MPI_C: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicc (found version "3.1")
-- Found MPI_CXX: /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicpc (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- MPI_INCLUDE_PATH :
-- MPI_LIBRARIES :
-- MPI_CXX_INCLUDE_PATH :
-- MPI_CXX_INCLUDE_DIRS :
-- MPI_CXX_LIBRARIES :
-- MPI_CXX_FOUND : TRUE
-- MPI_C_FOUND : TRUE
-- MPI_C_INCLUDE_DIRS :
-- MPI_C_COMPILER : /opt/intel/compilers_and_libraries_2018.3.222/linux/mpi/intel64/bin/mpiicc
-- MPI_C_INCLUDE_PATH :
-- MPI_C_LIBRARIES :
-- Configuring done
-- Generating done
-- Build files have been written to: /nfs/pdx/home/cwcongdo/RELION/relion/build
sh-4.2$
The ICC path worked like the GCC path through about CMake 3.9. It works like the above with 3.12.2 or 3.14.5. As you can imagine, this causes existing logic using the MPI CMake variables to break.
Any ideas/workarounds/suggestions welcome with thanks!
Charles