我有一个非常简单的“Hello world”程序,用mpic ++编译。我还有以下CMakeLists.txt
文件:
cmake_minimum_required(VERSION 2.8)
project(Hello_world)
add_executable(hello.e main.cpp)
# Require MPI for this project:
find_package(MPI REQUIRED)
include_directories(MPI_INCLUDE_PATH)
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})
target_link_libraries(hello.e ${MPI_LIBRARIES}
此cmake文件在Linux上运行良好,但在Mac OS X Mavericks上运行不正常。在小牛队,我得到:“mpi.h not found
”错误。
以下是cmake .
的输出,表明它找到了openmpi
:
-- The C compiler identification is AppleClang 5.1.0.5030040
-- The CXX compiler identification is AppleClang 5.1.0.5030040
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found MPI_C: /opt/local/lib/openmpi-devel-mp/libmpi.dylib
-- Found MPI_CXX: /opt/local/lib/openmpi-devel-mp/libmpi.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sleepyhead/work/MPI_TEST
我做错了什么?