我希望能在一台装有Intel Core i7的电脑上运行并行代码。我已经成功编译了代码,但在运行时遇到了问题。
我使用mpicxx编译代码,但当我运行" mpirun -np 8 ./a.out"时,只有一个进程在运行。我的操作系统是Linux Ubuntu 11.04。
请问我应该怎么做才能让它正常工作呢?
例如,我想要运行这段代码:
#include <iostream>
#include <mpi.h>
using namespace std;
int main(int argc, char **argv)
{
int mynode, totalnodes;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &totalnodes);
MPI_Comm_rank(MPI_COMM_WORLD, &mynode);
cout << "Hello world from process " << mynode;
cout << " of " << totalnodes << endl;
MPI_Finalize();
}
我使用带有mpirun --version:1.3.1的mpich2。