浏览代码

properly handle the situation where no one is able to execute the tasks

Cédric Augonnet 16 年之前
父节点
当前提交
8cbd5a62bc
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 13 2
      tests/microbenchs/sync_and_notify_data.c

+ 13 - 2
tests/microbenchs/sync_and_notify_data.c

@@ -65,6 +65,7 @@ int main(int argc, char **argv)
 	unsigned iter;
 	for (iter = 0; iter < K; iter++)
 	{
+		int ret;
 		unsigned ind;
 		for (ind = 0; ind < N; ind++)
 		{
@@ -86,7 +87,9 @@ int main(int argc, char **argv)
 
 			task->synchronous = 1;
 
-			starpu_submit_task(task);
+			ret = starpu_submit_task(task);
+			if (ret == -ENODEV)
+				goto enodev;
 		}
 
 		/* synchronize v in RAM */
@@ -118,7 +121,9 @@ int main(int argc, char **argv)
 
 			task->synchronous = 1;
 
-			starpu_submit_task(task);
+			ret = starpu_submit_task(task);
+			if (ret == -ENODEV)
+				goto enodev;
 		}
 
 	}
@@ -133,4 +138,10 @@ int main(int argc, char **argv)
 		return -1;
 
 	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 */
+	return 0;
 }