Reputation: 157
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
Upvotes: 1
Views: 1243
Reputation: 157
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.
Upvotes: 1