简体   繁体   中英

Visual Studio 2013 Configuration for MS-MPI

I have been spending days ( in fact nights) to configure my Visual Studio 2013 for MPI programming with C++ but my efforts have been to no avail. I have yet to compile a simple MPI version of Hello World program.

I have downloaded MS-MPI SDK and followed the instructions given here

The installation and environment variable setting is fine because step #2 is verified. I have also tried to follow up to instruction #5 carefully, only that my project and also the .cpp file have different names. My source code is as follows:

#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;

}

In the editor, all MPI commands and variables and as well as #include have error underlines and the compilation gives a bunch of error. The first two errors are

error C3861: 'MPI_Init': identifier not found

error C2065: 'MPI_COMM_WORLD': Hassan

Thanks everyone who spent time and read my question. I somehow managed to get it working. I had to select x64 for Active solution platform in Configuration Manager .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM