diff -ru mpiexec-0.78/mpiexec.c mpiexec-0.78.new/mpiexec.c --- mpiexec-0.78/mpiexec.c Mon Apr 11 16:56:45 2005 +++ mpiexec-0.78.new/mpiexec.c Tue Apr 12 10:43:36 2005 @@ -8,6 +8,9 @@ * * Copyright (C) 2000-5 Pete Wyckoff * + * Copyright (C) 2005 Institut National de Recherche en Informatique + * et Automatique + * * Distributed under the GNU Public License Version 2 or later (See LICENSE) */ #define _GNU_SOURCE /* hoping to get strsignal() from string.h */ @@ -176,6 +179,18 @@ __func__, sig, parse_signal_number(sig)); wait_tasks(sig, 0); exit(sig); +} + +void +notify_all(int sig) +{ + if (cl_args->verbose) + printf("%s: caught signal %d (%s), sending it to all tasks...\n", + __func__, sig, parse_signal_number(sig)); + if (sig == 18) + notify_tasks(18); + if (sig == 20) + notify_tasks(19); } /* diff -ru mpiexec-0.78/mpiexec.h mpiexec-0.78.new/mpiexec.h --- mpiexec-0.78/mpiexec.h Mon Apr 11 16:56:45 2005 +++ mpiexec-0.78.new/mpiexec.h Mon Apr 11 16:56:57 2005 @@ -114,6 +114,7 @@ */ /* mpiexec.c */ const char *resolve_exe(const char *exe); +void notify_all(int sig); void killall(int sig); void handle_signals(const int *list, int num, void (*handler)(int sig)); typedef int (*cull_compare_func)(task_cntrl_t *t1, task_cntrl_t *t2); diff -ru mpiexec-0.78/start_tasks.c mpiexec-0.78.new/start_tasks.c --- mpiexec-0.78/start_tasks.c Mon Apr 11 16:56:45 2005 +++ mpiexec-0.78.new/start_tasks.c Tue Apr 12 10:44:55 2005 @@ -5,6 +5,8 @@ * * Copyright (C) 2000-3 Ohio Supercomputer Center. * Copyright (C) 2000-5 Pete Wyckoff + * Copyright (C) 2005 Institut National de Recherche en Informatique + * et Automatique * * Distributed under the GNU Public License Version 2 or later (See LICENSE) */ @@ -354,8 +356,10 @@ { const int siglist[] = { SIGHUP, SIGINT, SIGTERM }; const int alarm_list[] = { SIGALRM }; + const int suspend_list[] = { SIGTSTP, SIGCONT }; handle_signals(siglist, list_count(siglist), killall); handle_signals(alarm_list, list_count(alarm_list), kill_others_now); + handle_signals(suspend_list, list_count(suspend_list), notify_all); } /* diff -ru mpiexec-0.78/wait_tasks.c mpiexec-0.78.new/wait_tasks.c --- mpiexec-0.78/wait_tasks.c Mon Apr 11 16:56:45 2005 +++ mpiexec-0.78.new/wait_tasks.c Tue Apr 12 10:45:36 2005 @@ -5,6 +5,8 @@ * * Copyright (C) 2000-3 Ohio Supercomputer Center. * Copyright (C) 2000-4 Pete Wyckoff + * Copyright (C) 2005 Institut National de Recherche en Informatique + * et Automatique * * Distributed under the GNU Public License Version 2 or later (See LICENSE) */ @@ -33,6 +35,24 @@ /* replace old event with the kill one */ tasks[i].evt_obit = tasks[i].evt; tasks[i].evt = evt; + } +} + +/* + * Use tm to send a signal to all tasks. + */ +void +notify_tasks(int signum) +{ + int i, err; + tm_event_t evt; + + /* printf("kill_tasks: killing with %d\n", signum); */ + /* ignore the generated event */ + for (i=0; i