Browse Source

Add functionality to disable signal catching
- either through field starpu_conf::catch_signals or through the
environment variable STARPU_CATCH_SIGNALS

Nathalie Furmento 6 years ago
parent
commit
e36c5991fd
4 changed files with 33 additions and 4 deletions
  1. 3 0
      ChangeLog
  2. 10 0
      doc/doxygen/chapters/501_environment_variables.doxy
  3. 12 0
      include/starpu.h
  4. 8 4
      src/core/workers.c

+ 3 - 0
ChangeLog

@@ -135,6 +135,9 @@ Small features:
   * New tool starpu_mpi_comm_trace.py to draw heatmap of MPI
     communications
   * Support for ARM performance libraries
+  * Add functionality to disable signal catching either through field
+    starpu_conf::catch_signals or through the environment variable
+    STARPU_CATCH_SIGNALS
 
 Changes:
   * Vastly improve simgrid simulation time.

+ 10 - 0
doc/doxygen/chapters/501_environment_variables.doxy

@@ -1246,6 +1246,16 @@ If the environment variable STARPU_HWLOC_INPUT is defined to the path of an XML
 To produce this XML file, use <c>lstopo file.xml</c>
 </dd>
 
+<dt>STARPU_CATCH_SIGNALS</dt>
+<dd>
+\anchor STARPU_CATCH_SIGNALS
+\addindex __env__STARPU_CATCH_SIGNALS
+By default, StarPU catch signals SIGINT, SIGSEGV and SIGTRAP to
+perform final actions such as dumping FxT trace files even though the
+application has crashed. Setting this variable to a value other than 1
+will disable this behaviour. This should be done on JVM systems which
+may use these signals for their own needs.
+The flag can also be set through the field starpu_conf::catch_signals.
 </dl>
 
 \section ConfiguringTheHypervisor Configuring The Hypervisor

+ 12 - 0
include/starpu.h

@@ -431,6 +431,18 @@ struct starpu_conf
 	void (*callback_worker_going_to_sleep)(unsigned workerid);
 	void (*callback_worker_waking_up)(unsigned workerid);
 #endif
+
+	/**
+	   Specify if StarPU should catch SIGINT, SIGSEGV and SIGTRAP
+	   signals to make sure final actions (e.g dumping FxT trace
+	   files) are done even though the application has crashed. By
+	   default (value = \c 1), signals are catched. It should be
+	   disabled on systems which already catch these signals for
+	   their own needs (e.g JVM)
+	   This can also be specified with the environment variable
+	   \ref STARPU_CATCH_SIGNALS
+	 */
+	int catch_signals;
 };
 
 /**

+ 8 - 4
src/core/workers.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2018                                Inria
  * Copyright (C) 2008-2019                                Université de Bordeaux
- * Copyright (C) 2010-2018                                CNRS
+ * Copyright (C) 2010-2019                                CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
  * Copyright (C) 2011                                     Télécom-SudParis
  * Copyright (C) 2016                                     Uppsala University
@@ -975,6 +975,7 @@ int starpu_conf_init(struct starpu_conf *conf)
 	conf->sched_policy = NULL;
 	conf->global_sched_ctx_min_priority = starpu_get_env_number("STARPU_MIN_PRIO");
 	conf->global_sched_ctx_max_priority = starpu_get_env_number("STARPU_MAX_PRIO");
+	conf->catch_signals = starpu_get_env_number_default("STARPU_CATCH_SIGNALS", 1);
 
 	/* Note that starpu_get_env_number returns -1 in case the variable is
 	 * not defined */
@@ -1203,11 +1204,14 @@ void _starpu_handler(int sig)
 
 void _starpu_catch_signals(void)
 {
-	act_sigint  = signal(SIGINT, _starpu_handler);
-	act_sigsegv = signal(SIGSEGV, _starpu_handler);
+	if (_starpu_config.conf.catch_signals == 1)
+	{
+		act_sigint  = signal(SIGINT, _starpu_handler);
+		act_sigsegv = signal(SIGSEGV, _starpu_handler);
 #ifdef SIGTRAP
-	act_sigtrap = signal(SIGTRAP, _starpu_handler);
+		act_sigtrap = signal(SIGTRAP, _starpu_handler);
 #endif
+	}
 }
 
 int starpu_init(struct starpu_conf *user_conf)