在四核处理器上运行 MPICH 时出错

Error when running MPICH on quadcore processor

本文关键字:MPICH 出错 运行 四核 处理器      更新时间:2023-10-16

我试图运行以下MPI代码,但遇到了如下所示的错误。如果您有人可以帮助我,将不胜感激。

#include <mpi.h>
#include <stdio.h>
int main(){
    int rank, size;
    MPI_Init(NULL, NULL);
//  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
//  MPI_Comm_size(MPI_COMM_WORLD, &size);
//  printf("Hello from %d of %dn", rank, size);
    MPI_Finalize();
    return 0;
}

错误:

$ mpirun -np 4 ./a.out
mpiexec_ubuntu: cannot connect to local mpd (/tmp/mpd2.console_joseph); possible causes:
  1. no mpd is running on this host
  2. an mpd is running but was started without a "console" (-n option)
In case 1, you can start an mpd on this host with:
    mpd &
and you will be able to run jobs just on this host.

只需按照错误消息所说的操作:在命令行上运行mpd&。

如果可能的话,我强烈建议您使用OpenMPI而不是MPICH。