gpt4 book ai didi

macos - 如何在 Mac OS X 上使用 mpi

转载 作者:行者123 更新时间:2023-12-02 04:12:39 34 4
gpt4 key购买 nike

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

我已经使用成功安装了 open-mpi

brew install open-mpi

我有 .c 文件可供编译和运行。当我输入:

mpicc -o <file> <file.c>

其次是

mpirun <file>

我明白了

[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

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 server init failed
--> Returned value Bad parameter (-5) instead of ORTE_SUCCESS

当我输入时,我也收到相同的消息:

mpirun -np 2 <file>

我做错了什么?

最佳答案

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

Open MPI 的安装相当简单

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/

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

#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();
}

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

$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 上完美运行

更新

如果您正在 macOS 上寻找与 MPI 相关的环境,我建议您查看模块的概念。

更新

上述博客条目有更新版本:

关于macos - 如何在 Mac OS X 上使用 mpi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42703861/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com