Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,703 Views

cmake - Could NOT find MPI_CXX

I am trying to compile the simulation software LAMMPS using CMake, and run into some trouble:
 

-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES) (found version "3.1")
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find MPI (missing: MPI_CXX_FOUND) (found version "3.1")
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindMPI.cmake:1688 (find_package_handle_standard_args)
  CMakeLists.txt:180 (find_package)

 

I do have the latest intel parallel studio

$ icc -V
Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

I'm on Archlinux, and the version of CMake I'm using is:

$ cmake --version
cmake version 3.16.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

My compilation options are:

-DCMAKE_C_COMPILER=mpiicc
-DCMAKE_C_FLAGS=-xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high
-DCMAKE_CXX_COMPILER=mpiicpc
-DCMAKE_CXX_FLAGS=-fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -O2 -std=c++11 -DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG -I${MKLROOT}/include
-DCMAKE_Fortran_COMPILER=mpiifort

Am I doing something wrong?

0 Kudos
6 Replies
Highlighted
Moderator
1,703 Views

Hi Vishnu,

It seems that after doing cmake its not detecting MPI, so check if you have properly sourced the MPI environment and check if MPI compiler and runtime is loaded properly.

If your MPI environment is set properly and still it showing same error try giving the MPI lib path to cmake like:

cmake ../<path_to_cmake> -D<MPI_path>/lib

If your issue still exists you can reach us out.

-Abhishek

0 Kudos
Highlighted
Novice
1,703 Views

I'm sourcing /opt/intel/composerxe/linux/bin/compilervars.sh, which in turn sources the right mpi script, among others.

So turns out, what I had to do, was specify the mpi compilers:

-DMPI_C_COMPILER=mpiicc
-DMPI_CXX_COMPILER=mpiicpc

This wasn't needed in the previous versions of LAMMPS or the intel compiler. I'm not sure what changed. It compiles fine now.

0 Kudos
Highlighted
Moderator
1,703 Views

Hi Vishnu,

With compilervarsh.sh you also have to source mpivarsh.sh which will load mpi compiler and also runtime, then you are good to go with the cmake.

As it compiles can we close this thread?

Reach us out if you face any other problem.

0 Kudos
Highlighted
Novice
1,703 Views

I think I found the problem. The variable PROD_DIR in the file compilervars.sh is set to "/opt/intel/compilers_and_libraries_2020.0.166/linux", and so, that is where it looks for the MPI libraries as well, while the 2020 version of Intel's MPI libs are not out yet.

This seems like bad design of the source-able file. Can you look into this?

0 Kudos
Highlighted
Moderator
1,703 Views

Hi Vishnu,

We know it's not yet released publically still, this script will choose the latest MPI environment in your case it might be 20191024(Update 6).

Though the variable PROD_DIR is set with /opt/intel/compiler/2020/compilers_and_libraries_2020.0.166/linux it will still target the latest MPI available in your environment, it will redirect to ${PROD_DIR}/mpi/intel64/bin/mpivars.sh script.

This design is made by taking care of the future need if you have an error in the sourcing environment using this script do share your logs.

Thank you

-Abhishek 

0 Kudos
Highlighted
Moderator
1,703 Views

Hello,

Can we close this thread?

0 Kudos