我已经花了好几天(实际上是好几个晚上)来配置我的 Visual Studio 2013 以使用 C++ 进行 MPI 编程,但我的努力无济于事。我还没有编译 Hello World 程序的简单 MPI 版本。
我已经下载了 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 都有错误下划线并且编译会给出一堆错误。前两个错误是
error C3861: 'MPI_Init': identifier not found
error C2065: 'MPI_COMM_WORLD': Hassan
最佳答案
感谢所有花时间阅读我的问题的人。我以某种方式设法让它工作。我必须在 Configuration Manager 中为 Active solution platform 选择 x64。
关于c++ - MS-MPI 的 Visual Studio 2013 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32608437/