Переглянути джерело

Use S4U's sg_actor_sleep_for when available

Samuel Thibault 6 роки тому
батько
коміт
413c84a424
4 змінених файлів з 15 додано та 1 видалено
  1. 2 0
      configure.ac
  2. 2 1
      include/starpu_config.h.in
  3. 3 0
      include/starpu_thread.h
  4. 8 0
      src/common/utils.c

+ 2 - 0
configure.ac

@@ -176,12 +176,14 @@ if test x$enable_simgrid = xyes ; then
 	AC_CHECK_HEADERS([simgrid/host.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_HOST_H], [1], [Define to 1 if you have host.h in simgrid/.])])
 	AC_CHECK_HEADERS([simgrid/simdag.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_SIMDAG_H], [1], [Define to 1 if you have simdag.h in simgrid/.])])
 	AC_CHECK_HEADERS([xbt/synchro.h], [AC_DEFINE([STARPU_HAVE_XBT_SYNCHRO_H], [1], [Define to 1 if you have synchro.h in xbt/.])])
+	AC_CHECK_HEADERS([simgrid/actor.h], [AC_DEFINE([STARPU_HAVE_SIMGRID_ACTOR_H], [1], [Define to 1 if you have actor.h in simgrid/.])])
 	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 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])
 	AC_CHECK_DECLS([smpi_process_set_user_data], [], [], [[#include <smpi/smpi.h>]])
 
 	# Oldies for compatibility with older simgrid

+ 2 - 1
include/starpu_config.h.in

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011,2012,2014,2016,2017                 Inria
- * Copyright (C) 2009-2018                                Université de Bordeaux
+ * Copyright (C) 2009-2019                                Université de Bordeaux
  * Copyright (C) 2010-2017,2019                           CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -43,6 +43,7 @@
 #undef STARPU_SIMGRID_MC
 #undef STARPU_SIMGRID_HAVE_XBT_BARRIER_INIT
 #undef STARPU_HAVE_SIMGRID_MSG_H
+#undef STARPU_HAVE_SIMGRID_ACTOR_H
 #undef STARPU_HAVE_XBT_SYNCHRO_H
 #undef STARPU_HAVE_VALGRIND_H
 #undef STARPU_HAVE_MEMCHECK_H

+ 3 - 0
include/starpu_thread.h

@@ -30,6 +30,9 @@
 #else
 #include <xbt/synchro_core.h>
 #endif
+#ifdef STARPU_HAVE_SIMGRID_ACTOR_H
+#include <simgrid/actor.h>
+#endif
 #ifdef STARPU_HAVE_SIMGRID_MSG_H
 #include <simgrid/msg.h>
 #else

+ 8 - 0
src/common/utils.c

@@ -536,7 +536,11 @@ void _starpu_gethostname(char *hostname, size_t size)
 void starpu_sleep(float nb_sec)
 {
 #ifdef STARPU_SIMGRID
+#  ifdef HAVE_SG_ACTOR_SLEEP_FOR
+	sg_actor_sleep_for(nb_sec);
+#  else
 	MSG_process_sleep(nb_sec);
+#  endif
 #elif defined(STARPU_HAVE_WINDOWS)
 	Sleep(nb_sec * 1000);
 #else
@@ -552,7 +556,11 @@ void starpu_sleep(float nb_sec)
 void starpu_usleep(float nb_micro_sec)
 {
 #ifdef STARPU_SIMGRID
+#  ifdef HAVE_SG_ACTOR_SLEEP_FOR
+	sg_actor_sleep_for(nb_micro_sec / 1000000);
+#  else
 	MSG_process_sleep(nb_micro_sec / 1000000);
+#  endif
 #elif defined(STARPU_HAVE_WINDOWS)
 	Sleep(nb_micro_sec / 1000);
 #elif HAVE_UNISTD_H