【问题标题】:Visual Studio 2013 Configuration for MS-MPIMS-MPI 的 Visual Studio 2013 配置
【发布时间】:2015-12-13 00:43:57
【问题描述】:

我一直在花费数天(实际上是数夜)来配置我的 Visual Studio 2013 以使用 C++ 进行 MPI 编程,但我的努力无济于事。我还没有编译一个简单的 MPI 版本的 Hello World 程序。

我已下载 MS-MPI SDK 并按照here 给出的说明进行操作

安装和环境变量设置没问题,因为步骤 #2 已验证。我还尝试仔细遵循指令 #5,只是我的项目和 .cpp 文件具有不同的名称。我的源代码如下:

#include <mpi.h>
#include "stdafx.h"
#include <iostream>

int main(int argc, char** argv) {

MPI_Init(NULL, NULL);

int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);

int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);

char processor_name[MPI_MAX_PROCESSOR_NAME];
int name_len;
MPI_Get_processor_name(processor_name, &name_len);

printf("Hello world from processor %s, rank %d"
    " out of %d processors\n",
    processor_name, world_rank, world_size);

MPI_Finalize();
return 0;

}

在编辑器中,所有 MPI 命令和变量以及#include 都有错误下划线,编译时会出现一堆错误。前两个错误是

错误 C3861:“MPI_Init”:找不到标识符

错误 C2065:“MPI_COMM_WORLD”: 哈桑

【问题讨论】:

  • 我知道这对您的 MPI 配置没有帮助,但您确实应该将 MPI 的初始化称为 MPI_Init(&amp;argc, &amp;argv)
  • 我遇到了同样的问题,但犯了一个愚蠢的错误。我写的是 MPI_init 而不是 MPI_Init(错过了第二个单词的大写)。

标签: c++ visual-studio-2013 mpi


【解决方案1】:

感谢所有花时间阅读我的问题的人。我以某种方式设法让它工作。我必须在 Configuration Manager 中为 Active solution platform 选择 x64。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-06
    • 1970-01-01
    • 2015-02-23
    • 1970-01-01
    • 1970-01-01
    • 2014-11-26
    • 2015-04-22
    • 2013-12-30
    相关资源
    最近更新 更多