Hi Nathan

Sorry for the long, long delay in responding - no reasonable excuse (just busy, 
switching over support areas, etc.). Hopefully, you already found the solution.

You can specify the signals to forward to children using an MCA parameter:

OMPI_MCA_ess_base_forward_signals=SIGINT

should do what you are seeking. You can get a list of these using the 
"ompi_info" program that comes with OpenMPI. In this case, you would find the 
above param with the following help output:

Comma-delimited list of additional signals (names or integers) to forward to 
application processes [\"none\" => forward nothing]. Signals provided by 
default include SIGTSTP, SIGUSR1, SIGUSR2, SIGABRT, SIGALRM, and SIGCONT


HTH
Ralph

> On Sep 28, 2019, at 4:42 AM, Nathan GREINER via users 
> <users@lists.open-mpi.org> wrote:
> 
> Dear open-mpi users,
> 
> I am using open-mpi in conjunction with the mpi4py package to run parallel 
> simulations using python on my local machine.
> 
> I use the following idiom:
> 
>    mpiexec -np 4 python myscript.py
> 
> When I hit ^C during the execution of the above command, the mpi program is 
> interrupted, and the python programs are also interrupted.
> 
> However, I get no traceback from the python programs, and more 
> problematically, the cleanup functions of these programs are not executed as 
> they should when these programs get interrupted.
> 
> The open-mpi documentation states that: "When orterun (<=> mpiexec <=> 
> mpirun) receives a SIGTERM and SIGINT, it will attempt to kill the entire job 
> by sending all processes in the job a SIGTERM, waiting a small number of 
> seconds, then sending all processes in the job a SIGKILL."
> 
> Thus, the python programs receive a SIGTERM signal instead of the SIGINT 
> signal that they would receive upon hitting ^C during an execution launched 
> with the idiom:
> 
>    python myscript.py
> 
> I know that there is a way to make the python programs handle the SIGTERM 
> signal as if it was a SIGINT signal (namely, raising a KeyboardInterrupt), 
> but I would prefer to be able to configure mpiexec to propagate the SIGINT 
> signal it receives instead of sending a SIGTERM signal to its children 
> processes.
> 
> Would you know how this could be achieved?
> 
> Thank you very much for your time and help,
> 
> Nathan GREINER
> 
> PS: I am new to the open-mpi users mailing list: is this the right place and 
> way to ask such a question?
> 
> 


Reply via email to