如何为xcode安装Openmpi? [英] how to install Openmpi for xcode?

查看:92
本文介绍了如何为xcode安装Openmpi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在xcode 4中运行一些MPI程序.我通过键入 sudo port install openmpi 从MacPort安装了openmpi,安装正常完成.然后,将opt/local/include/openmpi添加到我的用户标题搜索路径中,将"libmpi.dylib"和"libmpi_cxx.dylib"拖到我的项目中.

I'm trying to run some MPI programs in xcode 4. I installed openmpi from MacPort by typing sudo port install openmpi and the installation finished normally. Then I added opt/local/include/openmpi to my user header search paths, dragged the "libmpi.dylib" and "libmpi_cxx.dylib" into my project.

但是当我尝试运行该程序时,出现以下错误消息:

But then when I tried to run the program, I got the following error message:

Undefined symbols for architecture x86_64:
  "_MPI_Comm_accept", referenced from:
      MPI::Intracomm::Accept(char const*, MPI::Info const&, int) const in main.o
  "_MPI_Comm_connect", referenced from:
      MPI::Intracomm::Connect(char const*, MPI::Info const&, int) const in main.o
  "_MPI_Comm_disconnect", referenced from:
      MPI::Comm::Disconnect() in main.o
  "_MPI_Comm_get_errhandler", referenced from:
      MPI::Comm::Get_errhandler() const in main.o
  "_MPI_Comm_set_errhandler", referenced from:
      MPI::Comm::Set_errhandler(MPI::Errhandler const&) const in main.o
  "_MPI_Comm_spawn", referenced from:
      MPI::Intracomm::Spawn(char const*, char const**, int, MPI::Info const&, int) const in main.o
      MPI::Intracomm::Spawn(char const*, char const**, int, MPI::Info const&, int, int*) const in main.o
  "_MPI_Comm_spawn_multiple", referenced from:
      MPI::Intracomm::Spawn_multiple(int, char const**, char const***, int const*, MPI::Info const*, int) in main.o
      MPI::Intracomm::Spawn_multiple(int, char const**, char const***, int const*, MPI::Info const*, int, int*) in main.o
  "_MPI_Grequest_complete", referenced from:
      MPI::Grequest::Complete() in main.o
  "_MPI_Op_commutative", referenced from:
      MPI::Op::Is_commutative() const in main.o
  "_MPI_Reduce_local", referenced from:
      MPI::Op::Reduce_local(void const*, void*, int, MPI::Datatype const&) const in main.o
  "_MPI_Win_call_errhandler", referenced from:
      MPI::Win::Call_errhandler(int) const in main.o
  "_MPI_Win_get_errhandler", referenced from:
      MPI::Win::Get_errhandler() const in main.o
  "_MPI_Win_set_errhandler", referenced from:
      MPI::Win::Set_errhandler(MPI::Errhandler const&) const in main.o
  "_ompi_mpi_comm_null", referenced from:
      MPI::Intracomm::Intracomm(ompi_communicator_t*) in main.o
      MPI::Graphcomm::Graphcomm(ompi_communicator_t* const&) in main.o
      MPI::Cartcomm::Cartcomm(ompi_communicator_t* const&) in main.o
  "_ompi_mpi_comm_world", referenced from:
      _main in main.o
  "_ompi_mpi_double", referenced from:
      _main in main.o
  "_ompi_mpi_op_sum", referenced from:
      _main in main.o
  "_ompi_op_set_cxx_callback", referenced from:
      MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我在上述安装过程中缺少任何内容吗?

Am I missing anything in the above installation processes?

推荐答案

我遇到了同样的问题,当我从源代码编译openmpi时,添加了头文件和库搜索路径,但是却忘记了将库作为链接器标志添加到构建中设置.添加他们解决了这个问题.您可以输入 mpicc –showme 来查看运行 mpi 所需的库.

I had the same problem, when I compiled openmpi from the sources, added header and library search paths, but forgot to add libraries as the linker flags to the build settings. Adding them solved this. You can type mpicc –showme to see the libraries that are necessary for mpi to run.

这篇关于如何为xcode安装Openmpi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆