我正在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,它不会产生上述警告,但除此以外,还会产生错误,并且我不确定为什么。
希望对此有所帮助。如果是这样,我该如何重新安装打开的mpi?
答案 0 :(得分:0)
此错误已在https://github.com/open-mpi/ompi/issues/5798
进行了跟踪同时,您可以
mpirun --mca btl_vader_backing_directory /tmp ...
或
export OMPI_MCA_btl_vader_backing_directory=/tmp
mpirun ...