/* C Example */
#include <mpi.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
int main (int argc, char* argv[])
{
int rank, size;
int buffer_length = MPI_MAX_PROCESSOR_NAME;
char hostname[buffer_length];
MPI_Init (&argc, &argv); /* starts MPI */
MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */
MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */
MPI_Get_processor_name(hostname, &buffer_length); /* get hostname */
printf( "Hello world from process %d running on %s of %d\n", rank, hostname, size );
MPI_Finalize();
return 0;
}
以上程序在较小版本的 ubuntu 12.04 上编译并成功运行。的进程。但当我尝试执行数千个进程时,它失败了。为什么会这样呢? 我期望调度程序将线程保留在队列中并可以逐个分派(dispatch)(我在单核机器上运行此代码)
为什么大号会出现以下错误?流程以及如何解决这个问题?
root@ubuntu:/home# mpiexec -n 1000 ./hello
[proxy:0:0@ubuntu] HYDU_create_process (./utils/launch/launch.c:26): pipe error (Too many open files)
[proxy:0:0@ubuntu] launch_procs (./pm/pmiserv/pmip_cb.c:751): create process returned error
[proxy:0:0@ubuntu] HYD_pmcd_pmip_control_cmd_cb (./pm/pmiserv/pmip_cb.c:935): launch_procs returned error
[proxy:0:0@ubuntu] HYDT_dmxu_poll_wait_for_event (./tools/demux/demux_poll.c:77): callback returned error status
[proxy:0:0@ubuntu] main (./pm/pmiserv/pmip.c:226): demux engine error waiting for event
Killed
最佳答案
您的系统已达到打开文件限制。 Ubuntu 中的默认值为 1024。您可以尝试使用 ulimit 命令提高 session 中的限制。
ulimit -n 2048
关于MPI:为什么我的 MPICH 程序因大号而失败。进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19614861/