MPI突然停止了对多个核心的操作



这段代码以前使用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!

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

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

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!

我使用的是微软的mpi,项目配置没有改变。我真的不知道该怎么办。我还安装了intel并行工作室,并在重新启动之前将其与visualstudio集成。但我仍在使用Visual c++进行编译(与正常工作时的配置相同(

简单的修复方法是卸载intel parallel studio

最新更新