Compile C++ MPI Code on Windows

2019-07-27 22:23发布

I have just installed Microsoft MPI (MS-MPI) which "is a Microsoft implementation of the Message Passing Interface standard for developing and running parallel applications on the Windows platform".

The site also contains a link to a featured tutorial: How to compile and run a simple MS-MPI program.

The compilation there is done using Visual Studio.

How to compile a C++ MPI code at the command line (without using VS)?


A simple program to be compiled:

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

int main(int argc, char *argv[]) { 
MPI::Init(argc, argv);

     int num_procs = MPI::COMM_WORLD.Get_size();
     int rank = MPI::COMM_WORLD.Get_rank();
     std::cout << "Hello world from processes " << rank
                << " of " << num_procs << "\n";
MPI::Finalize();

return 0;
}

0条回答
登录 后发表回答