Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.

Cmake can't find MPI headers

colibrisson
Beginner
971 Views

I try to use Oneapi 2021.1 to compile Wordrank but I'm running into some issues.

I first installed CMake 3.19.6 to avoid the single quote error. I also sourced the setvars.sh.

During compilation I get the following error:

 

-- Could NOT find MPI_C (missing: MPI_C_HEADER_DIR) (found version "3.1")
-- Could NOT find MPI_CXX (missing: MPI_CXX_HEADER_DIR) (found version "3.1")
CMake Error at /snap/cmake/805/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND) (found version
"3.1")

Reason given by package: MPI component 'Fortran' was requested, but language Fortran is not enabled.

Call Stack (most recent call first):
/snap/cmake/805/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
/snap/cmake/805/share/cmake-3.19/Modules/FindMPI.cmake:1722 (find_package_handle_standard_args)
CMakeLists.txt:13 (find_package)

 

 

After adding enable_language(Fortran) to CMakeLists.txt I get this error:

 

-- The Fortran compiler identification is Intel 20.2.1.20201112
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /opt/intel/oneapi/compiler/2021.1.1/linux/bin/intel64/ifort - skipped
-- Checking whether /opt/intel/oneapi/compiler/2021.1.1/linux/bin/intel64/ifort supports Fortran 90
-- Checking whether /opt/intel/oneapi/compiler/2021.1.1/linux/bin/intel64/ifort supports Fortran 90 - yes
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.40") found components: program_options 
-- Could NOT find MPI_C (missing: MPI_C_HEADER_DIR) (found version "3.1")
-- Could NOT find MPI_CXX (missing: MPI_CXX_HEADER_DIR) (found version "3.1")
-- Could NOT find MPI_Fortran (missing: MPI_Fortran_F77_HEADER_DIR MPI_Fortran_MODULE_DIR) (found version "3.1")
CMake Error at /snap/cmake/805/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND MPI_Fortran_FOUND)
  (found version "3.1")
Call Stack (most recent call first):
  /snap/cmake/805/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
  /snap/cmake/805/share/cmake-3.19/Modules/FindMPI.cmake:1722 (find_package_handle_standard_args)
  CMakeLists.txt:15 (find_package)

 

 

Everything compiles just fine with GCC.

 

Could you help me figure out what is missing?

0 Kudos
6 Replies
GouthamK_Intel
Moderator
900 Views

Hi Colin,

Could you please let us know whether you have Intel oneAPI HPC Toolkit installed? If not, please use the below download link for Installing Intel oneAPI HPC Toolkit as it is required to get MPI and Fortran.

https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit/download.html

If Intel oneAPI HPC Toolkit is already installed, then please check whether MPI and ifort are installed correctly or not. Use the below commands to verify the installation.

mpiicc --version

ifort --version

If everything is installed successfully, please export the below commands and try recompiling the code.

export CC=mpiicc

export CXX=mpiicpc

If your issue persists, please provide the output of all the commands mentioned above.

Have a Good day.


Regards

Goutham


colibrisson
Beginner
893 Views

Hi Goutham,

 

Yes, I installed oneAPI HPC Toolkit:

 

$ mpiicc --version 
icc (ICC) 2021.1 Beta 20201112
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

$ ifort --version
ifort (IFORT) 2021.1 Beta 20201112
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

 

 

Even after exporting CC=mpiicc and CXX=mpiicpc compilation fails. I still get the same error message:

 

-- Could NOT find MPI_C (missing: MPI_C_HEADER_DIR) (found version "3.1")
-- Could NOT find MPI_CXX (missing: MPI_CXX_HEADER_DIR) (found version "3.1")
-- Could NOT find MPI_Fortran (missing: MPI_Fortran_F77_HEADER_DIR MPI_Fortran_MODULE_DIR) (found version "3.1")
CMake Error at /snap/cmake/834/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND MPI_Fortran_FOUND)
  (found version "3.1")

 

 

As you can see in the CMakeOutput.log attached, CMake found oneAPI MPI. I don't understand what's the issue with the headers...

colibrisson
Beginner
854 Views

I found where the problem is: my setvars.sh is setting I_MPI_ROOT to /opt/intel/oneapi/intelpython/latest instead of /opt/intel/oneapi/mpi/2021.1.1. Do you know the reason? How should I fix this?

GouthamK_Intel
Moderator
848 Views

Hi Colin,

Could you please confirm whether you have explicitly made any changes to setvars.sh script file or not?

Please try sourcing the setvars.sh file again and check if I_MPI_ROOT still points to an incorrect directory. If yes, share your setvars.sh file along with the screenshot of the echo $I_MPI_ROOT with us here.

As a workaround manually export I_MPI_ROOT variable and check if your issue still persists or not.

 

export I_MPI_ROOT=/opt/intel/oneapi/mpi/2021.1.1

 

 

Regards

Goutham

 

GouthamK_Intel
Moderator
811 Views

Hi Colin,

Reminder: Could you please let us know whether your issue is resolved or not? If not, please share the above-requested details.


Regards

Goutham


GouthamK_Intel
Moderator
785 Views

Hi Colin,

As we have not heard back from you, we are considering that your issue has been resolved and we have answered all your queries. So we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only 

Have a Good day!


Thanks & Regards

Goutham


Reply