Search code examples
command-promptmessage-passingwindows-consolempich

How to stop executing a MPI program in windows command prompt after infinite loop


I'm new to MPI programming. I'm in basic stage. So I use this command to run the program

mpirun -np 4 try

And this executes my program. I'm using MPICH NT. When I miss something an infinite loop starts. Suppose I fumbled with MPI_Send & MPI_Recv like

MPI_Send(&buf, 1, MPI_INT, 1, DEFAULT_TAG, MPI_COMM_WORLD);
MPI_Recv(&buf, 1, MPI_INT, 15, DEFAULT_TAG, MPI_COMM_WORLD, &status);

source & destination are wrong. Now while executing this command prompt froze. It doesn't allow me to do anything just froze. Then I had to restart the command prompt, again go to the directory etc. Imagine 50 times doing that..... How can I avoid restarting the command prompt? Is there any easy way to recover from the hung mode?


Solution

  • Most console programs respond to Ctrl+C to terminate operation. If that doesn't work, you can always kill mpirun.exe from task manager (Ctrl+Shift+Esc)