如何在Mac OS X上使用MPI [英] How to use mpi on Mac OS X

查看:999
本文介绍了如何在Mac OS X上使用MPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找在Mac上使用mpi的方法,但是一切都非常先进.

I have been searching for a way to use mpi on my mac but everything is very advanced.

我已成功使用

brew install open-mpi

我已经准备好要编译和运行的.c文件.当我键入:

I have .c files ready for compiling and running. When I type:

mpicc -o <file> <file.c>

之后

mpirun <file>

我知道

[xxxxx-MacBook-Pro.local:13623] [[44919,0],0] ORTE_ERROR_LOG:错误 文件orted/pmix/pmix_server.c中的参数,位于第262行
[xxxxx-MacBook-Pro.local:13623] [[44919,0],0] ORTE_ERROR_LOG:错误 文件ess_hnp_module.c中的参数在第666行

[xxxxx-MacBook-Pro.local:13623] [[44919,0],0] ORTE_ERROR_LOG: Bad parameter in file orted/pmix/pmix_server.c at line 262
[xxxxx-MacBook-Pro.local:13623] [[44919,0],0] ORTE_ERROR_LOG: Bad parameter in file ess_hnp_module.c at line 666

看起来orte_init出于某种原因失败;您的并行过程 可能会中止.并行处理有很多原因 在orte_init期间可能失败;其中一些是由于配置或 环境问题.此故障似乎是内部故障. 这是一些其他信息(可能仅与 Open MPI开发人员):

It looks like orte_init failed for some reason; your parallel process is likely to abort. There are many reasons that a parallel process can fail during orte_init; some of which are due to configuration or environment problems. This failure appears to be an internal failure; here's some additional information (which may only be relevant to an Open MPI developer):

pmix服务器初始化失败
->返回值Bad参数(-5)代替了ORTE_SUCCESS

pmix server init failed
--> Returned value Bad parameter (-5) instead of ORTE_SUCCESS

当我输入以下内容时,我也会收到相同的消息:

I also get the same message when I enter:

mpirun -np 2 <file>

我在做什么错了?

推荐答案

如果我是你,我会执行以下操作:

If I were you, I'd do following:

Open MPI的安装非常简单

Installation of Open MPI is fairly straightforward

https://www.open-mpi.org/software/ompi /v2.0/

> tar xf openmpi-2.0.2.tar
> cd openmpi-2.0.2/
> ./configure --prefix=$HOME/opt/usr/local
> make all
> make install
> $HOME/opt/usr/local/bin/mpirun --version
mpirun (Open MPI) 2.0.2

Report bugs to http://www.open-mpi.org/community/help/

您可以使用超简单的hello world进行测试

You can use super simple hello world for testing purposes

#include <mpi.h>
#include <stdio.h>

int main(int argc, char** argv) {
    MPI_Init(NULL, NULL);
    int rank;
    int world;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &world);
    printf("Hello: rank %d, world: %d\n",rank, world);
    MPI_Finalize();
}

一切就绪后,只需编译并运行代码

After everything is in place, simply compile and run the code

$HOME/opt/usr/local/bin/mpicc -o hello ./hello.c
$HOME/opt/usr/local/bin/mpirun -np 2 ./hello
Hello: rank 0, world: 2
Hello: rank 1, world: 2

在macOS上运行正常

Works perfectly fine on macOS

这篇关于如何在Mac OS X上使用MPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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