【发布时间】:2019-03-04 04:03:28
【问题描述】:
我正在 mpi 上运行一个用 C 语言编写的简单的 hello world 程序,我遇到的问题是我似乎无法为这个简单的程序执行 10 个进程。
#include <stdio.h>
#include "mpi.h"
int main(int argc, char *argv[])
{
int rank; //rank of the process
int size; //number of processes
MPI_Init(&argc,&argv); //inititate MPI environment
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
MPI_Comm_size(MPI_COMM_WORLD,&size);
printf("Hello world from process %d of %d\n",rank,size);
MPI_Finalize();
return 0;
}
我在终端上运行它:
mpicc -o hello helloworld.c
mpirun --oversubscribe -np 10 hello
输出:
Hello world from process 0 of 10
Hello world from process 2 of 10
Hello world from process 3 of 10
Hello world from process 9 of 10
Hello world from process 7 of 10
Hello world from process 1 of 10
Hello world from process 6 of 10
Hello world from process 5 of 10
Hello world from process 4 of 10
Hello world from process 8 of 10
-----------------------------------------------------------------------
---
A system call failed during shared memory initialization that should
not have. It is likely that your MPI job will now either abort or
experience performance degradation.
我意识到我可以在我的双核 mac 上超额订阅的最大值是 5,它不会产生上述警告,但除此之外,我会报错,我不知道为什么。
不胜感激。如果是这样,我该如何重新安装 open mpi?
【问题讨论】:
-
这是您应该直接向github.com/open-mpi/ompi/issues 报告的内容,您使用的是哪个版本的 Open MPI?你是怎么安装的? (预建二进制?
configure命令行?) -
@GillesGouaillardet 我正在使用最新版本的 Open MPI 3.1.2。我按照这里的方法intothewave.wordpress.com/2011/12/27/…
-
Open MPI slots issues 的可能重复项不要重复同样的问题。
-
听起来像是一种竞争条件。同时,您可以
mpirun --mca shmem posix ... -
问之前有没有试过?这是一个 shell 脚本,而不是 MPI。维基百科和/或谷歌会告诉你更多关于比赛条件的事情,我会知道的。