瀏覽代碼

tests/datawizard/data_lookup.c: detect when no PU can execute the codelet and skip the test

Nathalie Furmento 14 年之前
父節點
當前提交
59640039cb
共有 1 個文件被更改,包括 18 次插入6 次删除
  1. 18 6
      tests/datawizard/data_lookup.c

+ 18 - 6
tests/datawizard/data_lookup.c

@@ -40,22 +40,26 @@ static starpu_codelet cl = {
 	.nbuffers = 1
 };
 
-static void test_lazy_allocation()
+static int test_lazy_allocation()
 {
 	static const size_t count = 123;
 
 	size_t i;
 	void *pointer;
 	starpu_data_handle handle;
+	int ret;
 
 	/* Lazily-allocated vector.  */
 	starpu_vector_data_register(&handle, -1, 0 /* NULL */,
 				    count, sizeof(float));
 
-	starpu_insert_task(&cl,
-			   STARPU_W, handle,
-			   STARPU_VALUE, &count, sizeof(size_t),
-			   0);
+	ret = starpu_insert_task(&cl,
+				 STARPU_W, handle,
+				 STARPU_VALUE, &count, sizeof(size_t),
+				 0);
+	if (ret == -ENODEV) return ret;
+	/* 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 */
 
 	/* Acquire the handle, forcing a local allocation.  */
 	starpu_data_acquire(handle, STARPU_R);
@@ -76,6 +80,7 @@ static void test_lazy_allocation()
 	starpu_data_unregister(handle);
 
 	assert(starpu_data_lookup(pointer) == NULL);
+	return 0;
 }
 
 #define VECTOR_COUNT    12
@@ -215,10 +220,17 @@ int main(int argc, char *argv[])
 		starpu_free(vectors[i]);
 	}
 
-	test_lazy_allocation();
+	err = test_lazy_allocation();
+	if (err == -ENODEV) goto enodev;
 	test_filters();
 
 	starpu_shutdown();
 
 	return EXIT_SUCCESS;
+
+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 77;
 }