MPI 突然停止在多个内核上工作

MPI stopped working on multiple cores suddenly

这段代码在使用 mpi 之前运行良好

#include <mpi.h>
#include <iostream>

using namespace std;

int id, p;

int main(int argc, char* argv[])
{
    MPI_Init(&argc, &argv);

    MPI_Comm_rank(MPI_COMM_WORLD, &id);
    MPI_Comm_size(MPI_COMM_WORLD, &p);

    cout << "Processor " << id << " of " << p << endl;
    cout.flush();

    MPI_Barrier(MPI_COMM_WORLD);
    if (id == 0) cout << "Every process has got to this point now!" << endl;

    MPI_Finalize();
}

给出输出:

Processor 0 of 4
Processor 1 of 4
Processor 2 of 4
Processor 3 of 4
Every process has got to this point now!

当 运行 在 4 核上使用命令 mpiexec -n 4 ${executable filename}$

我重新启动了我的笔记本电脑(我不确定这是否是原因)并且 运行 相同的代码并在一个核心上输出:

Processor 0 of 1
Every process has got to this point now!
Processor 0 of 1
Every process has got to this point now!
Processor 0 of 1
Every process has got to this point now!
Processor 0 of 1
Every process has got to this point now!

我使用的是 Microsoft mpi,项目配置没有改变。 我真的不知道该怎么办。 我还安装了intel parallel studio,并在重启前与visual studio集成。 但我仍在使用 Visual C++ 进行编译(与正常工作时相同的配置)

简单的解决方法是卸载 intel parallel studio