Explorar o código

Use sg_actor_self_execute when available

Samuel Thibault %!s(int64=5) %!d(string=hai) anos
pai
achega
337d1ef324
Modificáronse 3 ficheiros con 31 adicións e 7 borrados
  1. 3 0
      ChangeLog
  2. 1 1
      configure.ac
  3. 27 6
      src/core/simgrid.c

+ 3 - 0
ChangeLog

@@ -23,6 +23,9 @@ New features:
   * Add get_max_size method to data interfaces for applications using data with
     variable size to express their maximal potential size.
 
+Small changes:
+  * Use the S4U interface of Simgrid instead of xbt and MSG.
+
 StarPU 1.3.3 (git revision xxx)
 ==============================================
 

+ 1 - 1
configure.ac

@@ -188,7 +188,7 @@ if test x$enable_simgrid = xyes ; then
 	AC_CHECK_FUNCS([MSG_process_attach MSG_zone_get_hosts MSG_process_self_name MSG_process_userdata_init])
 	AC_CHECK_FUNCS([xbt_mutex_try_acquire smpi_process_set_user_data sg_zone_get_by_name sg_link_name sg_host_route sg_host_self sg_host_speed simcall_process_create sg_config_continue_after_help])
 	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.])])
-	AC_CHECK_FUNCS([sg_actor_sleep_for sg_actor_self sg_actor_ref sg_host_get_properties sg_cfg_set_int simgrid_get_clock])
+	AC_CHECK_FUNCS([sg_actor_sleep_for sg_actor_self sg_actor_ref sg_host_get_properties sg_cfg_set_int sg_actor_self_execute simgrid_get_clock])
 	AC_CHECK_DECLS([smpi_process_set_user_data], [], [], [[#include <smpi/smpi.h>]])
 
 	# Oldies for compatibility with older simgrid

+ 27 - 6
src/core/simgrid.c

@@ -539,7 +539,11 @@ void _starpu_simgrid_deinit(void)
 
 struct task
 {
+#ifdef HAVE_SG_ACTOR_SELF_EXECUTE
+	double flops;
+#else
 	msg_task_t task;
+#endif
 
 	/* communication termination signalization */
 	unsigned *finished;
@@ -572,8 +576,12 @@ static int task_execute(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[] STARPU_AT
 			w->last_task = NULL;
 
 		_STARPU_DEBUG("task %p started\n", task);
+#ifdef HAVE_SG_ACTOR_SELF_EXECUTE
+		sg_actor_self_execute(task->flops);
+#else
 		MSG_task_execute(task->task);
 		MSG_task_destroy(task->task);
+#endif
 		_STARPU_DEBUG("task %p finished\n", task);
 
 		*task->finished = 1;
@@ -613,7 +621,10 @@ void _starpu_simgrid_wait_tasks(int workerid)
 void _starpu_simgrid_submit_job(int workerid, struct _starpu_job *j, struct starpu_perfmodel_arch* perf_arch, double length, unsigned *finished)
 {
 	struct starpu_task *starpu_task = j->task;
+	double flops;
+#ifndef HAVE_SG_ACTOR_SELF_EXECUTE
 	msg_task_t simgrid_task;
+#endif
 
 	if (j->internal)
 		/* This is not useful to include in simulation (and probably
@@ -630,27 +641,33 @@ void _starpu_simgrid_submit_job(int workerid, struct _starpu_job *j, struct star
                  * to be able to easily check scheduling robustness */
 	}
 
-	simgrid_task = MSG_task_create(_starpu_job_get_task_name(j),
 #if defined(HAVE_SG_HOST_SPEED) || defined(sg_host_speed)
 #  if defined(HAVE_SG_HOST_SELF) || defined(sg_host_self)
-			length/1000000.0*sg_host_speed(sg_host_self()),
+	flops = length/1000000.0*sg_host_speed(sg_host_self());
 #  else
-			length/1000000.0*sg_host_speed(MSG_host_self()),
+	flops = length/1000000.0*sg_host_speed(MSG_host_self());
 #  endif
 #elif defined HAVE_MSG_HOST_GET_SPEED || defined(MSG_host_get_speed)
-			length/1000000.0*MSG_host_get_speed(MSG_host_self()),
+	flops = length/1000000.0*MSG_host_get_speed(MSG_host_self());
 #else
-			length/1000000.0*MSG_get_host_speed(MSG_host_self()),
+	flops = length/1000000.0*MSG_get_host_speed(MSG_host_self());
+#endif
+
+#ifndef HAVE_SG_ACTOR_SELF_EXECUTE
+	simgrid_task = MSG_task_create(_starpu_job_get_task_name(j), flops, 0, NULL);
 #endif
-			0, NULL);
 
 	if (finished == NULL)
 	{
 		/* Synchronous execution */
 		/* First wait for previous tasks */
 		_starpu_simgrid_wait_tasks(workerid);
+#ifdef HAVE_SG_ACTOR_SELF_EXECUTE
+		sg_actor_self_execute(flops);
+#else
 		MSG_task_execute(simgrid_task);
 		MSG_task_destroy(simgrid_task);
+#endif
 	}
 	else
 	{
@@ -658,7 +675,11 @@ void _starpu_simgrid_submit_job(int workerid, struct _starpu_job *j, struct star
 		struct task *task;
 		struct worker_runner *w = &worker_runner[workerid];
 		_STARPU_MALLOC(task, sizeof(*task));
+#ifdef HAVE_SG_ACTOR_SELF_EXECUTE
+		task->flops = flops;
+#else
 		task->task = simgrid_task;
+#endif
 		task->finished = finished;
 		*finished = 0;
 		task->next = NULL;