【问题标题】:a simple MPI can't run after compile一个简单的 MPI 编译后无法运行
【发布时间】:2015-09-14 09:39:18
【问题描述】:

我写了一个简单的 MPI 程序:

   #include <stdio.h>
  2 #include "mpi.h"
  3 
  4 int main(int argc,char* argv[])
  5 {
  6         int rank;
  7         int size;
  8 
  9         MPI_Init(0,0);
 10         MPI_Comm_rank(MPI_COMM_WORLD,&rank);
 11         MPI_Comm_size(MPI_COMM_WORLD,&size);
 12         printf("Hello World from process %d of %d\n",rank,size);
 13         MPI_Finalize();
 14         return 0;
 15 }

程序编译成功,但无法运行

我使用“mpirun -np 4 ./hello”或“mpirun -np 4 hello”

显示如下:

_create_ep, create command failed: Operation not permitted
GLEX_ERR(ln0): _init_glex(608), _create_ep: system error
_create_ep, create command failed: Operation not permitted
GLEX_ERR(ln0): _init_glex(608), _create_ep: system error
_create_ep, create command failed: Operation not permitted
GLEX_ERR(ln0): _init_glex(608), _create_ep: system error
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(498)........: 
MPID_Init(187)...............: channel initialization failed
MPIDI_CH3_Init(89)...........: 
MPID_nem_init(320)...........: 
MPID_nem_glex_init(74).......: 
MPIDI_nem_glex_init_glex(610): Cannot create GLEX endpoint.

此外,我在 HPC 上编写了这个程序。我猜“无法创建 GLEX 端点”的问题可能与 HPC 相关(HPC 已经部署了 MPI)。

【问题讨论】:

  • 试试mpiexec -np 4 -f &lt;machinefile&gt; ./hello。您的机器文件包含主机名和每台主机上的处理器数量。

标签: runtime-error mpi hpc


【解决方案1】:

当空指针作为参数传递时,我不太确定对MPI_Init() 的支持程度(我认为自 MPI 3.0 以来有类似在不支持参数的情况下调用它,但我不会承诺) . 不过,我肯定会先将您代码中的MPI_Init(0,0) 替换为MPI_Init( &amp;argc, &amp;argv )

编辑:我的错,MPI_Init() 应该支持空指针作为参数,如 here 所述。 但是,尝试使用 MPI_Init( &amp;argc, &amp;argv ) 仍然是我解决问题的第一次尝试。

【讨论】:

  • 好的,这看起来像是环境问题。最有可能的是,如果它在 HPC 集群上运行,您需要通过 PBS、SLURM、LSF、LoadLeveller 等批处理调度程序提交您的作业……如果没有批处理环境,MPI_Init 无法初始化 MPI 环境,因此会出现错误消息。请参阅您的系统管理员或本地文档。
  • 谢谢。我已经解决了这个问题。 “yhrun -n 4 -p MIC mpitest”。该指令有效。
猜你喜欢
  • 2017-03-26
  • 2014-06-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多