2

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;
}
Sandu Ursu
  • 1,181
  • 1
  • 18
  • 28
  • Find the batch file that sets up your visual studio command line compiler and run it. Run compiler. Or google how to find those tools, and follow them. `call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"` then run msbuild and tell it the name of the project you want it to compile. But since you didn't load visual studio and create your project, have fun running the compiler `cl`and linker `link` manually. – Warren P May 31 '16 at 19:38
  • It is just that MS-MPI does not provide compiler wrappers. You have to manually provide the path to the include file and link against the import library. – Hristo Iliev Jun 01 '16 at 08:59
  • Did that, but I still get a fatal error: `sal.h: No such file or directory`. I have investigated a bit and it seems that I should find it in Visual Studio VC files, and it is not there (because I have uninstalled VS). I am wondering now if I can get `sal.h` and proceed to my compilatio, or it calls a lot of other stuff there? Anyone willing to share the stuff from the Include folder: `C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include`? – Sandu Ursu Jun 01 '16 at 12:30
  • "Walkthrough: Compiling a Native C++ Program on the Command Line" (https://msdn.microsoft.com/en-us/library/ms235639.aspx). (Sorry I'm late. Been in the hospital.) – Dick Bridges Jul 18 '16 at 17:39

0 Answers0