I want to use PETSc 3.8.2 with different versions of MPI (i.e. mpich-3.2.1, openmpi-3.0.0). Everything went well when I complied petsc with different MPIs. However, when I was trying to use FindMPI.cmake to locate the MPI, error occured as following,
-- Could NOT find MPI_C (missing: MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindMPI.cmake:1392 (find_package_handle_standard_args)
CMakeLists.txt:17 (FIND_PACKAGE)
And then I tried SET(MPI_DIR /opt/mpich-3.2.1), SET(MPI_ROOT /opt/mpich-3.2.1), and LIST(APPEND CMAKE_PREFIX_PATH /opt/mpich-3.2.1), similarly for openmpi. However, none of them can solve my problem. I configured both MPI package by ./configure --prefix=/opt/name-version.
, and then make
and sudo make install
.
Can anyone help me solve this problem ? Thanks in advance.