|
@@ -1153,6 +1153,40 @@ static void _starpu_build_tree(void)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+static struct sigaction act_sigint;
|
|
|
+static struct sigaction act_sigsegv;
|
|
|
+
|
|
|
+void _starpu_handler(int sig)
|
|
|
+{
|
|
|
+#ifdef STARPU_VERBOSE
|
|
|
+ _STARPU_MSG("Catching signal '%s'\n", sys_siglist[sig]);
|
|
|
+#endif
|
|
|
+#ifdef STARPU_USE_FXT
|
|
|
+ _starpu_fxt_dump_file();
|
|
|
+#endif
|
|
|
+ if (sig == SIGINT)
|
|
|
+ {
|
|
|
+ sigaction(SIGINT, &act_sigint, NULL);
|
|
|
+ }
|
|
|
+ if (sig == SIGSEGV)
|
|
|
+ {
|
|
|
+ sigaction(SIGSEGV, &act_sigsegv, NULL);
|
|
|
+ }
|
|
|
+#ifdef STARPU_VERBOSE
|
|
|
+ _STARPU_MSG("Rearming signal '%s'\n", sys_siglist[sig]);
|
|
|
+#endif
|
|
|
+ raise(sig);
|
|
|
+}
|
|
|
+
|
|
|
+void _starpu_catch_signals(void)
|
|
|
+{
|
|
|
+ struct sigaction act;
|
|
|
+ act.sa_handler = _starpu_handler;
|
|
|
+
|
|
|
+ sigaction(SIGINT, &act, &act_sigint);
|
|
|
+ sigaction(SIGSEGV, &act, &act_sigsegv);
|
|
|
+}
|
|
|
+
|
|
|
int starpu_init(struct starpu_conf *user_conf)
|
|
|
{
|
|
|
return starpu_initialize(user_conf, NULL, NULL);
|
|
@@ -1439,6 +1473,8 @@ int starpu_initialize(struct starpu_conf *user_conf, int *argc, char ***argv)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+ _starpu_catch_signals();
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1630,7 +1666,7 @@ void starpu_shutdown(void)
|
|
|
|
|
|
/* tell all workers to shutdown */
|
|
|
_starpu_kill_all_workers(&_starpu_config);
|
|
|
-
|
|
|
+
|
|
|
unsigned i;
|
|
|
unsigned nb_numa_nodes = starpu_memory_nodes_get_numa_count();
|
|
|
for (i=0; i<nb_numa_nodes; i++)
|