The FindMPI module does not seem to work on Windows with the Intel MPI libraries. I am trying (unsuccessfully) to compile parmetis and since I am new to CMake, I tried to reduce the problem I am experiencing to the simplest possible example (attached).

I have the latest (12.1) Intel Compiler installed and the Intel MPI wrappers are in the system PATH. From my command-line environment, I can easily compile hello.c with the mpicc wrapper, using either cl.exe or icl.exe as the underlying compiler.

However, FindMPI always reports the following (cmake -G"NMake Makefiles" -DWIN32=TRUE):

-- Could NOT find MPI_C (missing:  MPI_C_LIBRARIES)
-- Could NOT find MPI_CXX (missing:  MPI_CXX_LIBRARIES)
CMake Error at CMakeLists.txt:7 (message):
  mpi is not found

The comments of FindMPI suggest a few solutions to this (such as defining MPI_C_COMPILER or MPI_C_LIBRARIES and MPI_C_INCLUDE_PATH) but I have not been able to make them work. I am wondering what is the best way to work around the problem ....

As I said, very new to CMake but I wonder if _MPI_PREFIX_PATH could use fixing. For Intel MPI, the path is usually stored in "%I_MPI_ROOT%%ARCH_PATH_MPI%" rather than the registry.

Thanks,

Michel Lestrade
/* C Example */
#include <stdio.h>
#include <mpi.h>


int main (argc, argv)
     int argc;
     char *argv[];
{
  int rank, size;

  MPI_Init (&argc, &argv);      /* starts MPI */
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);        /* get current process id */
  MPI_Comm_size (MPI_COMM_WORLD, &size);        /* get number of processes */
  printf( "Hello world from process %d of %d\n", rank, size );
  MPI_Finalize();
  return 0;
}
cmake_minimum_required(VERSION 2.8)
project(hello)

# Search for MPI.
include(FindMPI)
if(NOT MPI_FOUND)
  message(FATAL_ERROR "mpi is not found")
endif()
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

target_link_libraries(${MPI_LIBRARIES})
set_target_properties(hello PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to