1

My mpi application has a signal handler to catch ctrl-C or ctrl-break one Windows, and when this application is run in serial in the cmd window, it is seen to work. It is intercepted, the code then does its last ouput, and the code quits gracefully.

However, when I run it in parallel with, e.g., "mpiexec -np 2 myparapp.exe", and hit ctrl-C or ctrl-break, the signal appears to not get to my application, because it is killed abruptly. Is there something special I need to do, like ensure my signal handler is registered at a particular place in the code?

I am using MSMPI, which I understand is a fork from mpich.

JR Cary
  • 31
  • 4
  • Which MPI implementation are you using? If OpenMPI, you might want to take a look at http://linux.die.net/man/1/mpiexec. – jandres742 Sep 07 '16 at 00:12
  • It seems likely that `mpiexec` is responding to the control-C by killing your process, perhaps intentionally, or perhaps it just doesn't catch the control-C and is being killed itself. Whether there is any way to fix this is going to depend on the specific implementation. (It may be helpful to note that Windows doesn't actually have signals, though the C runtime emulates them to some extent.) – Harry Johnston Sep 07 '16 at 01:23

1 Answers1

2

The folks at Microsoft kindly got back to me with,

Currently it is not possible to pass the Ctrl-C/Ctrl-Break event directly to the child processes. Mpiexec is has Ctrl-C handler to deal with aborting the applications cleanly but it does not pass the Ctrl-C event to the processes.

I am currently pursuing writing a wrapper for mpiexec that will intercept the signals and put down a file to signal to the application that it should quit.

JR Cary
  • 31
  • 4
  • You might want to ask whether there's anything your application can do to recognize that Mpiexec is trying to shut it down cleanly. – Harry Johnston Sep 08 '16 at 21:30