Browse Source

introduce new macro STARPU_ASSERT_MSG, icc was complaining on evaluation constant expressions ...

Nathalie Furmento 13 years ago
parent
commit
93e6c6224b

+ 7 - 3
include/starpu_util.h

@@ -35,12 +35,16 @@ extern "C"
 #define STARPU_MAX(a,b)	((a)<(b)?(b):(a))
 
 #ifdef STARPU_NO_ASSERT
-#define STARPU_ASSERT(x)	do {} while(0);
+#define STARPU_ASSERT(x)		do {} while(0);
+#define STARPU_ASSERT_MSG(x, msg)	do {} while(0);
 #else
 #  if defined(__CUDACC__) && defined(STARPU_HAVE_WINDOWS)
-#    define STARPU_ASSERT(x)	do { if (!(x)) *(int*)NULL = 0; } while(0)
+#    define STARPU_ASSERT(x)		do { if (!(x)) *(int*)NULL = 0; } while(0)
+#    define STARPU_ASSERT_MSG(x, msg)	do { if (!(x)) { fprintf(stderr, "%s\n", msg); *(int*)NULL = 0; }} while(0)
 #  else
-#    define STARPU_ASSERT(x)	assert(x)
+#    define STARPU_ASSERT(x)		assert(x)
+#    define STARPU_ASSERT_MSG(x, msg)	if (!(x)) { fprintf(stderr, "%s\n", msg); } ; assert(x)
+
 #  endif
 #endif
 

+ 2 - 2
src/core/dependencies/task_deps.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -81,7 +81,7 @@ void starpu_task_declare_deps_array(struct starpu_task *task, unsigned ndeps, st
 
 		struct _starpu_job *dep_job;
 		dep_job = _starpu_get_job_associated_to_task(dep_task);
-		STARPU_ASSERT(dep_job != job && "A task must not depend on itself.");
+		STARPU_ASSERT_MSG(dep_job != job, "A task must not depend on itself.");
 
 		_STARPU_TRACE_TASK_DEPS(dep_job, job);
 		_starpu_bound_task_dep(job, dep_job);

+ 2 - 2
src/core/perfmodel/perfmodel_history.c

@@ -436,7 +436,7 @@ static void dump_model_file(FILE *f, struct starpu_perfmodel *model)
 				}
 		}
 		else
-			STARPU_ASSERT(!"Unknown history-based performance model");
+			STARPU_ASSERT_MSG(0, "Unknown history-based performance model");
 	}
 
 	/* Writing stuff */
@@ -495,7 +495,7 @@ static void dump_model_file(FILE *f, struct starpu_perfmodel *model)
 					max_impl = nimpl + 1;
 		}
 		else
-			STARPU_ASSERT(!"Unknown history-based performance model");
+			STARPU_ASSERT_MSG(0, "Unknown history-based performance model");
 
 		if (max_impl == 0)
 			continue;

+ 2 - 2
src/core/workers.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  * Copyright (C) 2010, 2011  Institut National de Recherche en Informatique et Automatique
  * Copyright (C) 2011  Télécom-SudParis
  *
@@ -135,7 +135,7 @@ static int _starpu_can_use_nth_implementation(enum starpu_archtype arch, struct
 		return func != 0;
 	}
 	default:
-		STARPU_ASSERT(!"Unknown arch type");
+		STARPU_ASSERT_MSG(0, "Unknown arch type");
 	}
 }
 

+ 2 - 2
src/sched_policies/eager_central_priority_policy.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -155,7 +155,7 @@ static struct starpu_task *_starpu_priority_pop_task(void)
 		}
 		while (!task && priolevel-- > 0);
 	}
-	STARPU_ASSERT(starpu_worker_can_execute_task(starpu_worker_get_id(), task, 0) || !"prio does not support \"can_execute\"");
+	STARPU_ASSERT(starpu_worker_can_execute_task(starpu_worker_get_id(), task, 0), "prio does not support \"can_execute\"");
 
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&global_sched_mutex);