Browse Source

Replace more MSG functions with s4u functions

Samuel Thibault 6 years ago
parent
commit
6ebdb50d4c
3 changed files with 24 additions and 4 deletions
  1. 8 0
      src/common/thread.c
  2. 12 4
      src/core/simgrid.c
  3. 4 0
      src/drivers/cuda/driver_cuda.c

+ 8 - 0
src/common/thread.c

@@ -106,7 +106,11 @@ int starpu_pthread_create(starpu_pthread_t *thread, const starpu_pthread_attr_t
 int starpu_pthread_join(starpu_pthread_t thread STARPU_ATTRIBUTE_UNUSED, void **retval STARPU_ATTRIBUTE_UNUSED)
 {
 #if SIMGRID_VERSION >= 31400
+#  ifdef STARPU_HAVE_SIMGRID_ACTOR_H
+	sg_actor_join(thread, 1000000);
+#  else
 	MSG_process_join(thread, 1000000);
+#  endif
 #if SIMGRID_VERSION >= 31500 && SIMGRID_VERSION != 31559
 #  ifdef HAVE_SG_ACTOR_REF
 	sg_actor_unref(thread);
@@ -122,7 +126,11 @@ int starpu_pthread_join(starpu_pthread_t thread STARPU_ATTRIBUTE_UNUSED, void **
 
 int starpu_pthread_exit(void *retval STARPU_ATTRIBUTE_UNUSED)
 {
+#ifdef STARPU_HAVE_SIMGRID_ACTOR_H
+	sg_actor_kill(sg_actor_self());
+#else
 	MSG_process_kill(MSG_process_self());
+#endif
 	STARPU_ABORT_MSG("MSG_process_kill(MSG_process_self()) returned?!");
 }
 

+ 12 - 4
src/core/simgrid.c

@@ -139,7 +139,11 @@ int _starpu_simgrid_get_nbhosts(const char *prefix)
 		snprintf(name, sizeof(name), STARPU_MPI_AS_PREFIX"%d", starpu_mpi_world_rank());
 #if defined(HAVE_MSG_ZONE_GET_HOSTS) || defined(MSG_zone_get_hosts)
 		hosts = xbt_dynar_new(sizeof(sg_host_t), NULL);
+#  if defined(HAVE_SG_ZONE_GET_BY_NAME) || defined(sg_zone_get_by_name)
+		sg_zone_get_hosts(_starpu_simgrid_get_as_by_name(name), hosts);
+#  else
 		MSG_zone_get_hosts(_starpu_simgrid_get_as_by_name(name), hosts);
+#  endif
 #else
 		hosts = MSG_environment_as_get_hosts(_starpu_simgrid_get_as_by_name(name));
 #endif
@@ -368,7 +372,7 @@ int main(int argc, char **argv)
 	_STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
 
 	/* Run the application in a separate thread */
-	MSG_process_create_with_arguments("main", &do_starpu_main, tsd, MSG_get_host_by_name("MAIN"), argc, argv_cpy);
+	MSG_process_create_with_arguments("main", &do_starpu_main, tsd, _starpu_simgrid_get_host_by_name("MAIN"), argc, argv_cpy);
 
 	/* And run maestro in the main thread */
 	MSG_main();
@@ -410,7 +414,7 @@ void _starpu_simgrid_init_early(int *argc STARPU_ATTRIBUTE_UNUSED, char ***argv
 		/* And attach the main thread to the main simgrid process */
 		void **tsd;
 		_STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
-		MSG_process_attach("main", tsd, MSG_get_host_by_name("MAIN"), NULL);
+		MSG_process_attach("main", tsd, _starpu_simgrid_get_host_by_name("MAIN"), NULL);
 		/* We initialized through MSG_process_attach */
 		simgrid_started = 3;
 	}
@@ -482,7 +486,9 @@ void _starpu_simgrid_deinit(void)
 			if (t->runner)
 			{
 				starpu_sem_post(&t->sem);
-#if SIMGRID_VERSION >= 31400
+#ifdef STARPU_HAVE_SIMGRID_ACTOR_H
+				sg_actor_join(t->runner, 1000000);
+#elif SIMGRID_VERSION >= 31400
 				MSG_process_join(t->runner, 1000000);
 #else
 				starpu_sleep(1);
@@ -499,7 +505,9 @@ void _starpu_simgrid_deinit(void)
 	{
 		struct worker_runner *w = &worker_runner[i];
 		starpu_sem_post(&w->sem);
-#if SIMGRID_VERSION >= 31400
+#ifdef STARPU_HAVE_SIMGRID_ACTOR_H
+		sg_actor_join(w->runner, 1000000);
+#elif SIMGRID_VERSION >= 31400
 		MSG_process_join(w->runner, 1000000);
 #else
 		starpu_sleep(1);

+ 4 - 0
src/drivers/cuda/driver_cuda.c

@@ -1439,7 +1439,11 @@ int _starpu_cuda_is_direct_access_supported(unsigned node, unsigned handling_nod
 	if (starpu_node_get_kind(handling_node) == STARPU_CUDA_RAM)
 	{
 		starpu_sg_host_t host = _starpu_simgrid_get_memnode_host(handling_node);
+#  ifdef STARPU_HAVE_SIMGRID_ACTOR_H
+		const char* cuda_memcpy_peer = sg_host_get_property_value(host, "memcpy_peer");
+#  else
 		const char* cuda_memcpy_peer = MSG_host_get_property_value(host, "memcpy_peer");
+#  endif
 		return cuda_memcpy_peer && atoll(cuda_memcpy_peer);
 	}
 	else