瀏覽代碼

Use SIMGRID_VERSION to make tests look nicer

Samuel Thibault 7 年之前
父節點
當前提交
2eaedfd683
共有 5 個文件被更改,包括 28 次插入28 次删除
  1. 5 5
      src/common/thread.c
  2. 10 10
      src/core/simgrid.c
  3. 7 7
      src/core/simgrid_cpp.cpp
  4. 4 4
      src/datawizard/malloc.c
  5. 2 2
      src/drivers/cpu/driver_cpu.c

+ 5 - 5
src/common/thread.c

@@ -80,7 +80,7 @@ int starpu_pthread_create_on(char *name, starpu_pthread_t *thread, const starpu_
 	void *tsd;
 	_STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
 	*thread = MSG_process_create_with_arguments(name, _starpu_simgrid_thread_start, tsd, host, 2, _args);
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 15)
+#if SIMGRID_VERSION >= 31500
 	MSG_process_ref(*thread);
 #endif
 	return 0;
@@ -93,9 +93,9 @@ 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_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 14)
+#if SIMGRID_VERSION >= 31400
 	MSG_process_join(thread, 1000000);
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 15)
+#if SIMGRID_VERSION >= 31500
 	MSG_process_unref(thread);
 #endif
 #else
@@ -343,7 +343,7 @@ int starpu_pthread_cond_wait(starpu_pthread_cond_t *cond, starpu_pthread_mutex_t
 
 int starpu_pthread_cond_timedwait(starpu_pthread_cond_t *cond, starpu_pthread_mutex_t *mutex, const struct timespec *abstime)
 {
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 18)
+#if SIMGRID_VERSION >= 31800
 	struct timespec now, delta;
 	double delay;
 	int ret = 0;
@@ -960,7 +960,7 @@ int starpu_sem_trywait(starpu_sem_t *sem)
 
 int starpu_sem_getvalue(starpu_sem_t *sem, int *sval)
 {
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR > 13)
+#if SIMGRID_VERSION > 31300
 	*sval = MSG_sem_get_capacity(*sem);
 	return 0;
 #else

+ 10 - 10
src/core/simgrid.c

@@ -25,7 +25,7 @@
 #include <core/perfmodel/perfmodel.h>
 #include <core/workers.h>
 #include <core/simgrid.h>
-#if defined(HAVE_SIMGRID_SIMDAG_H) && (SIMGRID_VERSION_MAJOR >= 4 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 13))
+#if defined(HAVE_SIMGRID_SIMDAG_H) && (SIMGRID_VERSION >= 31300)
 #include <simgrid/simdag.h>
 #endif
 
@@ -40,7 +40,7 @@
 
 #pragma weak starpu_main
 extern int starpu_main(int argc, char *argv[]);
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 16)
+#if SIMGRID_VERSION < 31600
 #pragma weak smpi_main
 extern int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[]);
 #endif
@@ -252,7 +252,7 @@ void _starpu_start_simgrid(int *argc, char **argv)
 		stack_size = rlim.rlim_cur / 1024;
 #endif
 
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 13)
+#if SIMGRID_VERSION < 31300
 	extern xbt_cfg_t _sg_cfg_set;
 	xbt_cfg_set_int(_sg_cfg_set, "contexts/stack_size", stack_size);
 #else
@@ -260,7 +260,7 @@ void _starpu_start_simgrid(int *argc, char **argv)
 #endif
 
 	/* Load XML platform */
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 13)
+#if SIMGRID_VERSION < 31300
 	_starpu_simgrid_get_platform_path(3, path, sizeof(path));
 #else
 	_starpu_simgrid_get_platform_path(4, path, sizeof(path));
@@ -295,7 +295,7 @@ int main(int argc, char **argv)
 			_STARPU_ERROR("Your version of simgrid does not provide smpi_process_get_user_data, we can not continue without it\n");
 		}
 
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 16)
+#if SIMGRID_VERSION >= 31600
 		/* Recent versions of simgrid dlopen() us, so we don't need to
 		 * do circumvolutions, just init MPI early and run the application's main */
 		return _starpu_mpi_simgrid_init(argc, argv);
@@ -352,7 +352,7 @@ void _starpu_simgrid_init_early(int *argc STARPU_ATTRIBUTE_UNUSED, char ***argv
 		 * Try using --cfg=contexts/factory:thread instead."
 		 * See https://github.com/simgrid/simgrid/issues/141 */
 		_STARPU_DISP("Warning: In simgrid mode, the file containing the main() function of this application should to be compiled with starpu.h or starpu_simgrid_wrap.h included, to properly rename it into starpu_main to avoid having to use --cfg=contexts/factory:thread which reduces performance\n");
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 14) /* Only recent versions of simgrid support setting xbt_cfg_set_string before starting simgrid */
+#if SIMGRID_VERSION >= 31400 /* Only recent versions of simgrid support setting xbt_cfg_set_string before starting simgrid */
 		xbt_cfg_set_string("contexts/factory", "thread");
 #endif
 		/* We didn't catch application's main. */
@@ -432,7 +432,7 @@ void _starpu_simgrid_deinit(void)
 			if (t->runner)
 			{
 				MSG_sem_release(t->sem);
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 14)
+#if SIMGRID_VERSION >= 31400
 				MSG_process_join(t->runner, 1000000);
 #else
 				MSG_process_sleep(1);
@@ -449,7 +449,7 @@ void _starpu_simgrid_deinit(void)
 	{
 		struct worker_runner *w = &worker_runner[i];
 		MSG_sem_release(w->sem);
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 14)
+#if SIMGRID_VERSION >= 31400
 		MSG_process_join(w->runner, 1000000);
 #else
 		MSG_process_sleep(1);
@@ -460,7 +460,7 @@ void _starpu_simgrid_deinit(void)
 		starpu_pthread_queue_destroy(&_starpu_simgrid_task_queue[i]);
 	}
 
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 13)
+#if SIMGRID_VERSION >= 31300
 	/* clean-atexit introduced in simgrid 3.13 */
 	if ( xbt_cfg_get_boolean("clean-atexit"))
 	{
@@ -1018,7 +1018,7 @@ _starpu_simgrid_get_memnode_host(unsigned node)
 
 void _starpu_simgrid_count_ngpus(void)
 {
-#if (defined(HAVE_SG_LINK_NAME) || defined sg_link_name) && (SIMGRID_VERSION_MAJOR >= 4 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 13))
+#if (defined(HAVE_SG_LINK_NAME) || defined sg_link_name) && (SIMGRID_VERSION >= 31300)
 	unsigned src, dst;
 	msg_host_t ramhost = _starpu_simgrid_get_host_by_name("RAM");
 

+ 7 - 7
src/core/simgrid_cpp.cpp

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2016-2017                                CNRS
- * Copyright (C) 2012-2017                                Université de Bordeaux
+ * Copyright (C) 2012-2018                                Université de Bordeaux
  * Copyright (C) 2016-2017                                Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -52,7 +52,7 @@ static int _starpu_simgrid_xbt_thread_create_wrapper(int argc STARPU_ATTRIBUTE_U
 	smx_process_t
 #endif
 	self = SIMIX_process_self();
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 13)
+#if SIMGRID_VERSION < 31300
 	thread_data_t *t = (thread_data_t *) SIMIX_process_self_get_data(self);
 #else
 	thread_data_t *t = (thread_data_t *) SIMIX_process_self_get_data();
@@ -76,20 +76,20 @@ void _starpu_simgrid_xbt_thread_create(const char *name, void_f_pvoid_t code, vo
 	thread_data_t *res = (thread_data_t *) malloc(sizeof(thread_data_t));
 	res->userparam = param;
 	res->code = code;
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 13)
+#if SIMGRID_VERSION < 31300
 	res->father_data = SIMIX_process_self_get_data(SIMIX_process_self());
 #else
 	res->father_data = SIMIX_process_self_get_data();
 #endif
 
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 12)
+#if SIMGRID_VERSION < 31200
 	simcall_process_create(&process,
 #else
 	process = simcall_process_create(
 #endif
 	                         name,
 	                         _starpu_simgrid_xbt_thread_create_wrapper, res,
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 14)
+#if SIMGRID_VERSION < 31400
 	                         SIMIX_host_self_get_name(),
 #else
 #  ifdef HAVE_SG_HOST_SELF
@@ -98,12 +98,12 @@ void _starpu_simgrid_xbt_thread_create(const char *name, void_f_pvoid_t code, vo
 	                         SIMIX_host_self(),
 #  endif
 #endif
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 15)
+#if SIMGRID_VERSION < 31500
 				 -1.0,
 #endif
 				 0, NULL,
 	                         /*props */ NULL
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 15)
+#if SIMGRID_VERSION < 31500
 				 , 0
 #endif
 				 );

+ 4 - 4
src/datawizard/malloc.c

@@ -60,7 +60,7 @@ static int malloc_on_node_default_flags[STARPU_MAXNODES];
 
 /* This file is used for implementing "folded" allocation */
 #ifdef STARPU_SIMGRID
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 15)
+#if SIMGRID_VERSION < 31500
 /* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
 static int bogusfile = -1;
 static unsigned long _starpu_malloc_simulation_fold;
@@ -245,7 +245,7 @@ int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int fl
 #ifdef STARPU_SIMGRID
 	if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
 	{
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 15)
+#if SIMGRID_VERSION >= 31500
 		*A = SMPI_SHARED_MALLOC(dim);
 #else
 		/* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
@@ -494,7 +494,7 @@ int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags
 #ifdef STARPU_SIMGRID
 	if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
 	{
-#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 15)
+#if SIMGRID_VERSION >= 31500
 		SMPI_SHARED_FREE(A);
 #else
 		/* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
@@ -879,7 +879,7 @@ _starpu_malloc_init(unsigned dst_node)
 	disable_pinning = starpu_get_env_number("STARPU_DISABLE_PINNING");
 	malloc_on_node_default_flags[dst_node] = STARPU_MALLOC_PINNED | STARPU_MALLOC_COUNT;
 #ifdef STARPU_SIMGRID
-#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 15)
+#if SIMGRID_VERSION < 31500
 	/* Reasonably "costless" */
 	_starpu_malloc_simulation_fold = starpu_get_env_number_default("STARPU_MALLOC_SIMULATION_FOLD", 1) << 20;
 #endif

+ 2 - 2
src/drivers/cpu/driver_cpu.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2012,2014-2015,2017                 Inria
- * Copyright (C) 2008-2017                                Université de Bordeaux
+ * Copyright (C) 2008-2018                                Université de Bordeaux
  * Copyright (C) 2010                                     Mehdi Juhoor
  * Copyright (C) 2010-2017                                CNRS
  * Copyright (C) 2011                                     Télécom-SudParis
@@ -364,7 +364,7 @@ int _starpu_cpu_driver_run_once(struct _starpu_worker *cpu_worker)
 		/* No progress, wait */
 		starpu_pthread_wait_wait(&cpu_worker->wait);
  #else
-  #if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 18)
+  #if SIMGRID_VERSION >= 31800
 	if (!res && !task)
 	{
 		/* No progress, wait (but at most 1s for OpenMP support) */