VS2010: Compiling MPI program with MS-MPI sdk and runtime

  • Thread starter Thread starter José Hugo Elsas
  • Start date Start date
J

José Hugo Elsas

Guest
Dear members of msdn dev forum,

I am trying to compile and run a simple MPI program on visual studio 2010. The OS is Windows 10.

I tried to follow this tutorial on how to compile and run an MPI program:

How to compile and run a simple MS-MPI program

and installed ms-mpi runtime and sdk from this website:

Download Microsoft MPI v10.0 from Official Microsoft Download Center

The code is the following:


//#include <pch.h>
#include <stdio.h>
#include <stdlib.h>

#include <mpi.h>

int main(int argc, char* argv[]){
MPI_Init(&argc,&argv);

int rank;

MPI_Comm_rank(MPI_COMM_WORLD,&rank);

if(rank==0){
char helloStr[] = "Hello World";
MPI_Send( helloStr, _countof( helloStr ), MPI_CHARk, 1, 0, MPI_COMM_WORLD);
} else if(rank==1){
char helloStr[12];
MPI_Recv( helloStr, _countof( helloStr ), MPI_CHAR, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE );
printf ( "Rank 1 received string %s from Rank 0\n", helloStr );
}

MPI_Finalize();

return 0;
}




While trying to compile a simple hello world MPI program, above, I get the following error mesage:


1>------ Build started: Project: mpi_ms, Configuration: Release x64 ------
1>Build started 05-Feb-19 11:35:25 AM.
1>InitializeBuildStatus:
1> Touching "x64\Release\mpi_ms.unsuccessfulbuild".
1>ClCompile:
1> msmpi.cpp
1>C:\Program Files (x86)\Microsoft SDKs\MPI\Include\mpi.h(4617): error C2061: syntax error : identifier '_Out_writes_'
1>C:\Program Files (x86)\Microsoft SDKs\MPI\Include\mpi.h(4618): error C2059: syntax error : ')'
1>C:\Program Files (x86)\Microsoft SDKs\MPI\Include\mpi.h(4618): error C2143: syntax error : missing ')' before ';'
1>C:\Program Files (x86)\Microsoft SDKs\MPI\Include\mpi.h(4629): error C2061: syntax error : identifier '_Out_writes_'
1>C:\Program Files (x86)\Microsoft SDKs\MPI\Include\mpi.h(4630): error C2059: syntax error : ')'
1>C:\Program Files (x86)\Microsoft SDKs\MPI\Include\mpi.h(4630): error C2143: syntax error : missing ')' before ';'
1>msmpi.cpp(16): error C2065: 'MPI_CHARk' : undeclared identifier
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.46
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Do anyone here have any idea of what is going on? This is my first time trying to compile and run MPI C programs outside linux environment. I know the MPI runtime is working because I've tried with python scripts using MPI4py.


Best regards,

José Hugo

Continue reading...
 
Back
Top