我也跟着下面的教程上的代码块MPI_Comm_size总是在代码块返回1
执行MPITutorial for installing MPI on Code blocks
如果我执行简单的MPI代码的教程来了,我总能得到1 MPI_Comm_size。 如何从下面的代码获取更多线程?
#include <iostream>
#include "mpi.h"
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
int my_rank; /* rank of process */
int noProcesses; /* number of processes */
int nameSize; /* length of name */
char computerName[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc, &argv); /*START MPI */
/*Determines the size of the group associated with a communicator */
MPI_Comm_size(MPI_COMM_WORLD, &noProcesses);
/*Determines the rank of the calling process in the communicator*/
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
/*Gets the name of the processor*/
MPI_Get_processor_name(computerName, &nameSize);
printf("Hello from process %d of %d processor on %s\n", my_rank, noProcesses, computerName);
MPI_Finalize(); /* EXIT MPI */
return 0;
}
我已经试过在相应位置的cmd提示符mpiexec -n 2 file.exe
。
但我得到一个错误信息Can't find ~~ __gxx_personality_v0 ~~~ DLL libstdc++-6.dll ~~~.
我通过重命名等mpiexec.exe文件解决。在我的情况下,它是在C:\ Program Files \ Microsoft MPI \ Bin。
请将您的解决方案转换为答案。之后你甚至可以接受。 – niklasfi 2014-10-29 07:00:31