Explorar o código

simgrid: make it dump backtraces on abortion

Samuel Thibault %!s(int64=5) %!d(string=hai) anos
pai
achega
f180f21d95
Modificáronse 3 ficheiros con 19 adicións e 1 borrados
  1. 1 1
      configure.ac
  2. 17 0
      src/core/simgrid.c
  3. 1 0
      src/core/simgrid.h

+ 1 - 1
configure.ac

@@ -196,7 +196,7 @@ if test x$enable_simgrid = xyes ; then
 	AC_CHECK_TYPES([smx_actor_t], [AC_DEFINE([STARPU_HAVE_SMX_ACTOR_T], [1], [Define to 1 if you have the smx_actor_t type.])], [], [[#include <simgrid/simix.h>]])
 
 	# Latest functions
-	AC_CHECK_FUNCS([MSG_process_attach sg_actor_attach sg_actor_init sg_actor_set_stacksize MSG_zone_get_hosts sg_zone_get_hosts MSG_process_self_name MSG_process_userdata_init sg_actor_data])
+	AC_CHECK_FUNCS([MSG_process_attach sg_actor_attach sg_actor_init sg_actor_set_stacksize sg_actor_on_exit MSG_zone_get_hosts sg_zone_get_hosts MSG_process_self_name MSG_process_userdata_init sg_actor_data])
 	AC_CHECK_FUNCS([xbt_mutex_try_acquire smpi_process_set_user_data SMPI_thread_create sg_zone_get_by_name sg_link_name sg_link_bandwidth_set sg_host_route sg_host_self sg_host_list sg_host_speed simcall_process_create sg_config_continue_after_help])
 	AC_CHECK_FUNCS([simgrid_init], [AC_DEFINE([STARPU_SIMGRID_HAVE_SIMGRID_INIT], [1], [Define to 1 if you have the `simgrid_init' function.])])
 	AC_CHECK_FUNCS([xbt_barrier_init], [AC_DEFINE([STARPU_SIMGRID_HAVE_XBT_BARRIER_INIT], [1], [Define to 1 if you have the `xbt_barrier_init' function.])])

+ 17 - 0
src/core/simgrid.c

@@ -97,6 +97,21 @@ void _starpu_simgrid_set_stack_size(size_t stack_size)
 #endif
 }
 
+#ifdef HAVE_SG_ACTOR_ON_EXIT
+static void on_exit_backtrace(int failed, void *data STARPU_ATTRIBUTE_UNUSED)
+{
+	if (failed)
+		xbt_backtrace_display_current();
+}
+#endif
+
+void _starpu_simgrid_actor_setup(void)
+{
+#ifdef HAVE_SG_ACTOR_ON_EXIT
+	sg_actor_on_exit(on_exit_backtrace, NULL);
+#endif
+}
+
 #if defined(HAVE_SG_ZONE_GET_BY_NAME) || defined(sg_zone_get_by_name)
 #define HAVE_STARPU_SIMGRID_GET_AS_BY_NAME
 sg_netzone_t _starpu_simgrid_get_as_by_name(const char *name)
@@ -360,6 +375,7 @@ int do_starpu_main(int argc, char *argv[])
 {
 	/* FIXME: Ugly work-around for bug in simgrid: the MPI context is not properly set at MSG process startup */
 	starpu_sleep(0.000001);
+	_starpu_simgrid_actor_setup();
 
 	if (!starpu_main)
 	{
@@ -1168,6 +1184,7 @@ _starpu_simgrid_thread_start(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[])
 
 	/* FIXME: Ugly work-around for bug in simgrid: the MPI context is not properly set at MSG process startup */
 	starpu_sleep(0.000001);
+	_starpu_simgrid_actor_setup();
 
 	/* _args is freed with process context */
 	f(arg);

+ 1 - 0
src/core/simgrid.h

@@ -63,6 +63,7 @@ void _starpu_simgrid_init_early(int *argc, char ***argv);
 void _starpu_simgrid_init(void);
 void _starpu_simgrid_deinit(void);
 void _starpu_simgrid_deinit_late(void);
+void _starpu_simgrid_actor_setup(void);
 void _starpu_simgrid_wait_tasks(int workerid);
 struct _starpu_job;
 void _starpu_simgrid_submit_job(int workerid, struct _starpu_job *job, struct starpu_perfmodel_arch* perf_arch, double length, unsigned *finished);