Procházet zdrojové kódy

tests/: improve error checking

Nathalie Furmento před 13 roky
rodič
revize
13cd230e8c

+ 17 - 5
tests/core/declare_deps_after_submission_synchronous.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -20,6 +20,7 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define NLOOPS	128
 
@@ -51,7 +52,8 @@ int main(int argc, char **argv)
 	int ret;
 	unsigned loop;
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	struct starpu_task *taskA, *taskB;
 
@@ -67,21 +69,31 @@ int main(int argc, char **argv)
 		taskA->synchronous = 1;
 
 		ret = starpu_task_submit(taskA);
-		STARPU_ASSERT(!ret);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 		starpu_task_declare_deps_array(taskB, 1, &taskA);
 
 		taskB->synchronous = 1;
 
 		ret = starpu_task_submit(taskB);
-		STARPU_ASSERT(!ret);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 		starpu_task_destroy(taskA);
 	}
 
-	starpu_task_wait_for_all();
+	ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
 
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 16 - 4
tests/core/declare_deps_in_callback.c

@@ -21,6 +21,7 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define NLOOPS	128
 
@@ -60,10 +61,11 @@ static struct starpu_task *create_dummy_task(void)
 
 int main(int argc, char **argv)
 {
-	//	int ret;
+	int ret;
 	unsigned loop;
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	struct starpu_task *taskA, *taskB;
 
@@ -75,12 +77,22 @@ int main(int argc, char **argv)
 		taskA->callback_func = callback;
 		taskA->callback_arg = taskB;
 
-		starpu_task_submit(taskA);
+		ret = starpu_task_submit(taskA);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 	}
 
-	starpu_task_wait_for_all();
+	ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
 
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 18 - 5
tests/core/empty_task.c

@@ -21,6 +21,8 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
+
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 static unsigned ntasks = 65536;
@@ -47,13 +49,15 @@ static void parse_args(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
+	int ret;
 	double timing;
 	struct timeval start;
 	struct timeval end;
 
 	parse_args(argc, argv);
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	FPRINTF(stderr, "#tasks : %u\n", ntasks);
 
@@ -68,11 +72,13 @@ int main(int argc, char **argv)
 
 		task->detach = 0;
 		task->destroy = 1;
-		
-		int ret = starpu_task_submit(task);
-		STARPU_ASSERT(!ret);
 
-		starpu_task_wait(task);
+		ret = starpu_task_submit(task);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+
+		ret = starpu_task_wait(task);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
 	}
 
 	gettimeofday(&end, NULL);
@@ -85,4 +91,11 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 16 - 4
tests/core/empty_task_chain.c

@@ -16,6 +16,7 @@
  */
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define N	4
 
@@ -23,7 +24,8 @@ int main(int argc, char **argv)
 {
 	int i, ret;
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	struct starpu_task **tasks = (struct starpu_task **) malloc(N*sizeof(struct starpu_task *));
 
@@ -36,7 +38,8 @@ int main(int argc, char **argv)
 		{
 			starpu_task_declare_deps_array(tasks[i], 1, &tasks[i-1]);
 			ret = starpu_task_submit(tasks[i]);
-			STARPU_ASSERT(!ret);
+			if (ret == -ENODEV) goto enodev;
+			STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 		}
 
 		if (i == (N-1))
@@ -44,12 +47,21 @@ int main(int argc, char **argv)
 	}
 
 	ret = starpu_task_submit(tasks[0]);
-	STARPU_ASSERT(!ret);
+	if (ret == -ENODEV) goto enodev;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
-	starpu_task_wait(tasks[N-1]);
+	ret = starpu_task_wait(tasks[N-1]);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
 
 	starpu_shutdown();
 	free(tasks);
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 15 - 11
tests/core/empty_task_sync_point.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -21,6 +21,7 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 static starpu_tag_t tagA = 0x0042;
 static starpu_tag_t tagB = 0x1042;
@@ -33,7 +34,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attri
 {
 }
 
-static starpu_codelet dummy_codelet = 
+static starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_func = dummy_func,
@@ -45,19 +46,22 @@ static starpu_codelet dummy_codelet =
 
 int main(int argc, char **argv)
 {
-	starpu_init(NULL);
+	int ret;
+
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	/* {A,B,C} -> D -> {E,F}, D is empty */
 	struct starpu_task *taskA = starpu_task_create();
 	taskA->cl = &dummy_codelet;
 	taskA->use_tag = 1;
 	taskA->tag_id = tagA;
-	
+
 	struct starpu_task *taskB = starpu_task_create();
 	taskB->cl = &dummy_codelet;
 	taskB->use_tag = 1;
 	taskB->tag_id = tagB;
-	
+
 	struct starpu_task *taskC = starpu_task_create();
 	taskC->cl = &dummy_codelet;
 	taskC->use_tag = 1;
@@ -81,12 +85,12 @@ int main(int argc, char **argv)
 	taskF->tag_id = tagF;
 	starpu_tag_declare_deps(tagF, 1, tagD);
 
-	starpu_task_submit(taskA);
-	starpu_task_submit(taskB);
-	starpu_task_submit(taskC);
-	starpu_task_submit(taskD);
-	starpu_task_submit(taskE);
-	starpu_task_submit(taskF);
+	ret = starpu_task_submit(taskA); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskB); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskC); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskD); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskE); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskF); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	starpu_tag_t tag_array[2] = {tagE, tagF};
 	starpu_tag_wait_array(2, tag_array);

+ 17 - 12
tests/core/empty_task_sync_point_tasks.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011  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
@@ -16,12 +16,13 @@
  */
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
-static starpu_codelet dummy_codelet = 
+static starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_func = dummy_func,
@@ -33,15 +34,18 @@ static starpu_codelet dummy_codelet =
 
 int main(int argc, char **argv)
 {
-	starpu_init(NULL);
+	int ret;
+
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	/* {A,B,C} -> D -> {E,F}, D is empty */
 	struct starpu_task *taskA = starpu_task_create();
 	taskA->cl = &dummy_codelet;
-	
+
 	struct starpu_task *taskB = starpu_task_create();
 	taskB->cl = &dummy_codelet;
-	
+
 	struct starpu_task *taskC = starpu_task_create();
 	taskC->cl = &dummy_codelet;
 
@@ -59,14 +63,15 @@ int main(int argc, char **argv)
 	starpu_task_declare_deps_array(taskE, 1, &taskD);
 	starpu_task_declare_deps_array(taskF, 1, &taskD);
 
-	starpu_task_submit(taskA);
-	starpu_task_submit(taskB);
-	starpu_task_submit(taskC);
-	starpu_task_submit(taskD);
-	starpu_task_submit(taskE);
-	starpu_task_submit(taskF);
+	ret = starpu_task_submit(taskA); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskB); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskC); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskD); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskE); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(taskF); STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
-	starpu_task_wait_for_all();
+	ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
 
 	starpu_shutdown();
 

+ 10 - 4
tests/core/execute_on_a_specific_worker.c

@@ -21,6 +21,7 @@
 #include <starpu.h>
 #include <stdlib.h>
 #include <pthread.h>
+#include "../common/helper.h"
 
 #define N	1000
 
@@ -86,9 +87,12 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+
+	ret = starpu_malloc((void **)&v, VECTORSIZE*sizeof(unsigned));
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_malloc");
 
-	starpu_malloc((void **)&v, VECTORSIZE*sizeof(unsigned));
 	starpu_vector_data_register(&v_handle, 0, (uintptr_t)v, VECTORSIZE, sizeof(unsigned));
 
 	unsigned nworker = starpu_worker_get_count();
@@ -114,8 +118,8 @@ int main(int argc, char **argv)
 			task->workerid = worker;
 
 			int ret = starpu_task_submit(task);
-			if (ret == -ENODEV)
-				goto enodev;
+			if (ret == -ENODEV) goto enodev;
+			STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 		}
 	}
 
@@ -130,6 +134,8 @@ int main(int argc, char **argv)
 	return 0;
 
 enodev:
+	starpu_free(v);
+	starpu_shutdown();
 	fprintf(stderr, "WARNING: No one can execute this task\n");
 	/* yes, we do not perform the computation but we did detect that no one
  	 * could perform the kernel, so this is not an error from StarPU */

+ 21 - 10
tests/core/get_current_task.c

@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -48,11 +49,10 @@ static struct starpu_codelet_t dummy_cl = {
 
 int main(int argc, char **argv)
 {
-//	double timing;
-//	struct timeval start;
-//	struct timeval end;
+	int ret;
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 #ifdef STARPU_SLOW_MACHINE
 	ntasks /= 10;
@@ -73,12 +73,14 @@ int main(int argc, char **argv)
 		task->callback_func = check_task_callback;
 		task->callback_arg = task;
 
-		int ret = starpu_task_submit(task);
-		STARPU_ASSERT(!ret);
+		ret = starpu_task_submit(task);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 	}
 
-	starpu_task_wait_for_all();
-	
+	ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
+
 	FPRINTF(stderr, "#empty tasks : %u\n", ntasks);
 
 	/* We repeat the same experiment with null codelets */
@@ -94,12 +96,21 @@ int main(int argc, char **argv)
 		task->callback_arg = task;
 
 		int ret = starpu_task_submit(task);
-		STARPU_ASSERT(!ret);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 	}
 
-	starpu_task_wait_for_all();
+	ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
 
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 11 - 4
tests/core/insert_task.c

@@ -15,6 +15,7 @@
  */
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -44,7 +45,8 @@ int main(int argc, char **argv)
 	float ffactor=10.0;
         starpu_data_handle data_handles[2];
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	x = 1;
 	starpu_variable_data_register(&data_handles[0], 0, (uintptr_t)&x, sizeof(x));
@@ -59,11 +61,14 @@ int main(int argc, char **argv)
 				 STARPU_RW, data_handles[0], STARPU_RW, data_handles[1],
 				 0);
 	if (ret == -ENODEV) goto enodev;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_insert_task");
 
-        starpu_task_wait_for_all();
+        ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
 
         for(i=0 ; i<2 ; i++) {
-                starpu_data_acquire(data_handles[i], STARPU_R);
+                ret = starpu_data_acquire(data_handles[i], STARPU_R);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_data_acquire");
         }
         FPRINTF(stderr, "VALUES: %d %f\n", x, f);
 
@@ -88,7 +93,8 @@ int main(int argc, char **argv)
 	starpu_task_submit(task);
         starpu_task_wait_for_all();
         for(i=0 ; i<2 ; i++) {
-                starpu_data_acquire(data_handles[i], STARPU_R);
+                ret = starpu_data_acquire(data_handles[i], STARPU_R);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_data_acquire");
         }
         FPRINTF(stderr, "VALUES: %d %f\n", x, f);
 
@@ -97,6 +103,7 @@ int main(int argc, char **argv)
 	return 0;
 
 enodev:
+	starpu_shutdown();
 	fprintf(stderr, "WARNING: No one can execute this task\n");
 	/* yes, we do not perform the computation but we did detect that no one
  	 * could perform the kernel, so this is not an error from StarPU */

+ 15 - 2
tests/core/regenerate.c

@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <pthread.h>
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -79,10 +80,12 @@ int main(int argc, char **argv)
 	double timing;
 	struct timeval start;
 	struct timeval end;
+	int ret;
 
 	parse_args(argc, argv);
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	struct starpu_task task;
 
@@ -98,7 +101,9 @@ int main(int argc, char **argv)
 
 	gettimeofday(&start, NULL);
 
-	starpu_task_submit(&task);
+	ret = starpu_task_submit(&task);
+	if (ret == -ENODEV) goto enodev;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	pthread_mutex_lock(&mutex);
 	if (!completed)
@@ -116,4 +121,12 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }
+

+ 5 - 1
tests/core/restart.c

@@ -22,6 +22,8 @@
 #include <starpu.h>
 #include <stdlib.h>
 
+#include "../common/helper.h"
+
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 #define N	10
@@ -35,13 +37,15 @@ int main(int argc, char **argv)
 
 	double init_timing = 0.0;
 	double shutdown_timing = 0.0;
+	int ret;
 
 	for (iter = 0; iter < N; iter++)
 	{
 		gettimeofday(&start, NULL);
 		/* Initialize StarPU */
-		starpu_init(NULL);
+		ret = starpu_init(NULL);
 		gettimeofday(&end, NULL);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 		init_timing += (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
 		gettimeofday(&start, NULL);

+ 17 - 6
tests/core/starpu_task_wait.c

@@ -21,6 +21,7 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -30,7 +31,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attri
 {
 }
 
-static starpu_codelet dummy_codelet = 
+static starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_func = dummy_func,
@@ -65,6 +66,7 @@ int main(int argc, char **argv)
 	double timing;
 	struct timeval start;
 	struct timeval end;
+	int ret;
 
 	parse_args(argc, argv);
 
@@ -72,7 +74,8 @@ int main(int argc, char **argv)
 	ntasks /= 10;
 #endif
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	FPRINTF(stderr, "#tasks : %u\n", ntasks);
 
@@ -90,12 +93,13 @@ int main(int argc, char **argv)
 
 		task->detach = 0;
 		task->destroy = 0;
-		
-		int ret = starpu_task_submit(task);
-		STARPU_ASSERT(!ret);
+
+		ret = starpu_task_submit(task);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 		ret = starpu_task_wait(task);
-		STARPU_ASSERT(!ret);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
 
 		starpu_task_destroy(task);
 	}
@@ -110,4 +114,11 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 18 - 5
tests/core/starpu_task_wait_for_all.c

@@ -20,6 +20,7 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -57,7 +58,7 @@ static void init_gordon_kernel(void)
 #endif
 }
 
-static void inject_one_task(void)
+static int inject_one_task(void)
 {
 	struct starpu_task *task = starpu_task_create();
 
@@ -67,7 +68,7 @@ static void inject_one_task(void)
 	task->callback_arg = NULL;
 
 	int ret = starpu_task_submit(task);
-	STARPU_ASSERT(!ret);
+	return ret;
 }
 
 static struct starpu_conf conf = {
@@ -111,6 +112,7 @@ int main(int argc, char **argv)
 	double timing;
 	struct timeval start;
 	struct timeval end;
+	int ret;
 
 	parse_args(argc, argv);
 
@@ -118,7 +120,8 @@ int main(int argc, char **argv)
 	ntasks /= 10;
 #endif
 
-	starpu_init(&conf);
+	ret = starpu_init(&conf);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	init_gordon_kernel();
 
@@ -127,10 +130,13 @@ int main(int argc, char **argv)
 	gettimeofday(&start, NULL);
 	for (i = 0; i < ntasks; i++)
 	{
-		inject_one_task();
+		ret = inject_one_task();
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 	}
 
-	starpu_task_wait_for_all();
+	ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
 
 	gettimeofday(&end, NULL);
 
@@ -142,4 +148,11 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 16 - 2
tests/core/static_restartable.c

@@ -20,6 +20,7 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -58,10 +59,12 @@ int main(int argc, char **argv)
 	double timing;
 	struct timeval start;
 	struct timeval end;
+	int ret;
 
 	parse_args(argc, argv);
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	struct starpu_task task;
 
@@ -76,8 +79,12 @@ int main(int argc, char **argv)
 
 	for (i = 0; i < ntasks; i++)
 	{
-		starpu_task_submit(&task);
+		ret = starpu_task_submit(&task);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+
 		starpu_task_wait(&task);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
 	}
 
 	gettimeofday(&end, NULL);
@@ -91,4 +98,11 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 16 - 2
tests/core/static_restartable_tag.c

@@ -20,6 +20,7 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -60,10 +61,12 @@ int main(int argc, char **argv)
 	double timing;
 	struct timeval start;
 	struct timeval end;
+	int ret;
 
 	parse_args(argc, argv);
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	struct starpu_task task;
 
@@ -80,8 +83,12 @@ int main(int argc, char **argv)
 
 	for (i = 0; i < ntasks; i++)
 	{
-		starpu_task_submit(&task);
+		ret = starpu_task_submit(&task);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+
 		starpu_tag_wait(tag);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
 	}
 
 	gettimeofday(&end, NULL);
@@ -95,4 +102,11 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 17 - 4
tests/core/static_restartable_using_initializer.c

@@ -20,6 +20,7 @@
 #include <unistd.h>
 
 #include <starpu.h>
+#include "../common/helper.h"
 
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
@@ -32,7 +33,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attri
 {
 }
 
-static starpu_codelet dummy_codelet = 
+static starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_func = dummy_func,
@@ -52,7 +53,6 @@ static void parse_args(int argc, char **argv)
 			break;
 	}
 
-	
 }
 
 int main(int argc, char **argv)
@@ -61,10 +61,12 @@ int main(int argc, char **argv)
 	double timing;
 	struct timeval start;
 	struct timeval end;
+	int ret;
 
 	parse_args(argc, argv);
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	task.cl = &dummy_codelet;
 	task.detach = 0;
@@ -75,8 +77,12 @@ int main(int argc, char **argv)
 
 	for (i = 0; i < ntasks; i++)
 	{
-		starpu_task_submit(&task);
+		ret = starpu_task_submit(&task);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+
 		starpu_task_wait(&task);
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
 	}
 
 	gettimeofday(&end, NULL);
@@ -90,4 +96,11 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 18 - 8
tests/core/subgraph_repeat.c

@@ -19,6 +19,8 @@
 #include <starpu.h>
 #include <pthread.h>
 
+#include "../common/helper.h"
+
 static unsigned niter = 16384;
 
 /*
@@ -48,7 +50,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attri
 	STARPU_ATOMIC_ADD(&check_cnt, 1);
 }
 
-static starpu_codelet dummy_codelet = 
+static starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_func = dummy_func,
@@ -84,8 +86,10 @@ int main(int argc, char **argv)
 //	double timing;
 //	struct timeval start;
 //	struct timeval end;
+	int ret;
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	starpu_task_init(&taskA);
 	taskA.cl = &dummy_codelet;
@@ -111,10 +115,10 @@ int main(int argc, char **argv)
 	struct starpu_task *depsD_array[2] = {&taskB, &taskC};
 	starpu_task_declare_deps_array(&taskD, 2, depsD_array);
 
-	starpu_task_submit(&taskA);
-	starpu_task_submit(&taskB);
-	starpu_task_submit(&taskC);
-	starpu_task_submit(&taskD);
+	ret = starpu_task_submit(&taskA); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(&taskB); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(&taskC); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(&taskD); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	/* Wait for the termination of all loops */
 	pthread_mutex_lock(&mutex);
@@ -123,15 +127,21 @@ int main(int argc, char **argv)
 	pthread_mutex_unlock(&mutex);
 
 	STARPU_ASSERT(check_cnt == (4*loop_cnt));
-	
+
 	/* Cleanup the statically allocated tasks */
 	starpu_task_deinit(&taskA);
 	starpu_task_deinit(&taskB);
 	starpu_task_deinit(&taskC);
 	starpu_task_deinit(&taskD);
 
-
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }

+ 19 - 7
tests/core/subgraph_repeat_regenerate.c

@@ -19,6 +19,8 @@
 #include <starpu.h>
 #include <pthread.h>
 
+#include "../common/helper.h"
+
 static unsigned niter = 16384;
 
 /*
@@ -48,7 +50,7 @@ static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attri
 	STARPU_ATOMIC_ADD(&check_cnt, 1);
 }
 
-static starpu_codelet dummy_codelet = 
+static starpu_codelet dummy_codelet =
 {
 	.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL,
 	.cpu_func = dummy_func,
@@ -82,8 +84,10 @@ int main(int argc, char **argv)
 //	double timing;
 //	struct timeval start;
 //	struct timeval end;
+	int ret;
 
-	starpu_init(NULL);
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	/* Implicit data dependencies and regeneratable tasks are not compatible */
 	starpu_data_set_default_sequential_consistency_flag(0);
@@ -116,10 +120,10 @@ int main(int argc, char **argv)
 	struct starpu_task *depsD_array[2] = {&taskB, &taskC};
 	starpu_task_declare_deps_array(&taskD, 2, depsD_array);
 
-	starpu_task_submit(&taskA);
-	starpu_task_submit(&taskB);
-	starpu_task_submit(&taskC);
-	starpu_task_submit(&taskD);
+	ret = starpu_task_submit(&taskA); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(&taskB); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(&taskC); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	ret = starpu_task_submit(&taskD); if (ret == -ENODEV) goto enodev; STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	/* Wait for the termination of all loops */
 	pthread_mutex_lock(&mutex);
@@ -128,7 +132,7 @@ int main(int argc, char **argv)
 	pthread_mutex_unlock(&mutex);
 
 	STARPU_ASSERT(check_cnt == (4*loop_cnt));
-	
+
 	/* Cleanup the statically allocated tasks */
 	starpu_task_deinit(&taskA);
 	starpu_task_deinit(&taskB);
@@ -138,4 +142,12 @@ int main(int argc, char **argv)
 	starpu_shutdown();
 
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	starpu_shutdown();
+	return 77;
 }
+