我按照下面的教程在代码块上执行mpi
如果我执行简单的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 \Microsoft\Bin中。
发布于 2014-10-30 03:28:51
这个问题是由系统路径中的另一个mpiexec.exe引起的。
因此,我在前面写了特定的完整路径,比如:"C:\Program Files\MPICH2\bin\mpiexec.exe“。
之后,将"C:\Program \Microsoft\Bin“中的另一个mpiexec.exe文件重命名为"C:\Program \Microsoft MPI_temp\Bin”。
但是,在重命名"smpd版本错配“之后,它会产生另一个错误。所以我通过smpd -version查看了它的版本。是"1.0.3“。因此,我只需通过"smpd.exe -install“命令重新安装smpd。
https://stackoverflow.com/questions/26607899
复制相似问题