首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MPI_Comm_size总是在代码块上返回1

问MPI_Comm_size总是在代码块上返回1
EN

Stack Overflow用户
提问于 2014-10-28 12:04:02
回答 1查看 1.8K关注 0票数 0

我按照下面的教程在代码块上执行mpi

代码块上安装MPI教程

如果我执行简单的MPI代码来自教程,我总是得到1的MPI_Comm_size。如何从下面的代码中获得更多的线程?

代码语言:javascript
复制
#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中。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26607899

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档