我正在运行一个简单的hello world程序,用C语言在mpi上编写,我遇到的问题是,我似乎不能为这个简单的程序执行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,这不会产生如上所述的警告,但任何超过这一点的东西都会给我错误,我不知道为什么。
希望能在这方面得到一些帮助。如果是这样的话,我该如何重新安装打开的mpi?
2条答案
按热度按时间muk1a3rh1#
在https://github.com/open-mpi/ompi/issues/5798跟踪此错误
同时,您可以
或
3b6akqbq2#
有一个类似的问题在mac上,即使没有超额订阅插槽和解决方案,我第一次看到这里为我工作.尝试: