6

I'm trying out Microsoft's implementation of MPI. I installed the CCP sdk from here:

http://www.microsoft.com/en-us/download/details.aspx?id=239

And then in my project settings I added the include folder, the lib folder and mentioned msmpi.lib.

With the remaining settings as-is, I build the program and then in the command prompt I proceed to run the program, but nothing happens after I start it up.

Here's the code (It's supposed to display the id numbers for each thread):

#include "stdafx.h"
#include "mpi.h"
#include <stdio.h>

//Commands in cmd prompt
//cd "C:\Program Files\Microsoft Compute Cluster Pack\Bin"
//mpiexec.exe -n 2 "C:\Users\MyNameHere\Documents\Visual Studio 2012\Projects\tspMpi\Debug\tspMpi.exe"

int main(int argc, char* argv[]) 
{
 int  nTasks = 0, rank = 0; 

 MPI_Init(&argc,&argv); 
 MPI_Comm_size(MPI_COMM_WORLD,&nTasks);
 MPI_Comm_rank(MPI_COMM_WORLD,&rank);

 printf ("Number of threads = %d, My rank = %d\n", nTasks, rank);


  return 0;
 MPI_Finalize();
}

As soon as I run mpiexec.exe (the commands are in the comments) the program just does nothing, until I press Ctrl-C. Does anyone know what I'm doing wrong? There are no errors when I build the program, and if I run it from visual studio, it acts as if there was only one process started up.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Xavier Varricatt
  • 61
  • 1
  • 1
  • 2
  • Can you run the samples provided with the SDK? – zeFrenchy Oct 21 '12 at 19:44
  • I didn't find any documentation/samples with the SDK in the link I've shown. – Xavier Varricatt Oct 22 '12 at 00:47
  • 2
    MPI_Finalize(); should be before the return statement – veda Oct 22 '12 at 04:33
  • I managed to solve the problem myself (I think!) From the documentation here (msdn.microsoft.com/en-us/library/cc136762(v=VS.85).aspx) I got that there is another product HPC that I was actually supposed to use. I decided to try out this HPC product instead, and when I did the same steps everything seems to work fine now. What doesn't work, is when I use a getchar statement, I can't see the output properly. Any idea why? – Xavier Varricatt Oct 22 '12 at 04:33
  • Hi veda, thanks for pointing that out too. I made that correction as well. – Xavier Varricatt Oct 22 '12 at 04:35

1 Answers1

7

I didn't find SDK useful at all, here are my steps to enable MPI cluster debugging in VS 2010 (VC10):

step 1. Install MS-MPI: http://www.microsoft.com/en-us/download/details.aspx?id=36045 (x64 only), this creates

C:\Program Files\Microsoft HPC Pack 2012\Inc
C:\Program Files\Microsoft HPC Pack 2012\Lib\amd64
C:\Program Files\Microsoft HPC Pack 2012\Lib\i386

step 2. Download example: http://msdn.microsoft.com/en-us/library/ee441265(v=vs.100).aspx#BKMK_debugMany

step 3. Debugging setting: Right click on the Startup Project > Properties > Debugging

Debugger to launch, change "Local Windows Debugger" to "MPI Cluster Debugger"
Run Environment, change "localhost/1" to "localhost/4"

Right click on Visudal Studio Toolbar area to check "Debug Location", now you can switch Process and its Threads in the Debug Location toolbar, have fun!

Jichao
  • 1,753
  • 1
  • 14
  • 11