在CMAKE中将不同版本的MPI与PETSc链接

时间:2017-12-07 09:30:47

标签: cmake mpi clion openmpi mpich

我想将PETSc 3.8.2用于不同版本的MPI(即mpich-3.2.1,openmpi-3.0.0)。当我用不同的MPI编写petc时,一切顺利。但是,当我尝试使用FindMPI.cmake来定位MPI时,出现如下错误,

-- 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)

然后我尝试了SET(MPI_DIR /opt/mpich-3.2.1),SET(MPI_ROOT /opt/mpich-3.2.1)和LIST(APPEND CMAKE_PREFIX_PATH /opt/mpich-3.2.1),类似于的openmpi。但是,他们都无法解决我的问题。我按./configure --prefix=/opt/name-version.,然后makesudo make install配置了两个MPI包。

任何人都可以帮我解决这个问题吗?提前谢谢。

0 个答案:

没有答案