Quellcode durchsuchen

tests: add new test tests/datawizard/partition_lazy.c to illustrate bug reported by Cyril Bordage

	starpu_data_register(NULL) --> starpu_data_partition() --> task submission on sub handles --> starpu_data_unpartition() fails

		lt-partition_lazy: ../../../src/datawizard/filters.c:362: starpu_data_unpartition: Assertion `nvalids > 0' failed.
Nathalie Furmento vor 13 Jahren
Ursprung
Commit
0901fbea21
2 geänderte Dateien mit 113 neuen und 2 gelöschten Zeilen
  1. 15 2
      tests/Makefile.am
  2. 98 0
      tests/datawizard/partition_lazy.c

+ 15 - 2
tests/Makefile.am

@@ -180,8 +180,9 @@ noinst_PROGRAMS =				\
 	datawizard/interfaces/variable/variable_interface    \
 	datawizard/interfaces/vector/test_vector_interface   \
 	datawizard/interfaces/void/void_interface \
-	datawizard/in_place_partition   \
-	datawizard/gpu_register   \
+	datawizard/in_place_partition   	\
+	datawizard/partition_lazy		\
+	datawizard/gpu_register   		\
 	errorcheck/starpu_init_noworker		\
 	errorcheck/invalid_blocking_calls	\
 	errorcheck/invalid_tasks		\
@@ -284,6 +285,18 @@ datawizard_in_place_partition_SOURCES +=	\
 	datawizard/scal_opencl.cl
 endif
 
+datawizard_partition_lazy_SOURCES =	\
+	datawizard/partition_lazy.c	\
+	datawizard/scal.c
+if STARPU_USE_CUDA
+datawizard_partition_lazy_SOURCES +=	\
+	datawizard/scal_cuda.cu
+endif
+if STARPU_USE_OPENCL
+datawizard_partition_lazy_SOURCES +=	\
+	datawizard/scal_opencl.cl
+endif
+
 datawizard_gpu_register_SOURCES =	\
 	datawizard/gpu_register.c	\
 	datawizard/scal.c

+ 98 - 0
tests/datawizard/partition_lazy.c

@@ -0,0 +1,98 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2011  Université de Bordeaux 1
+ *
+ * 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
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <starpu.h>
+#include <starpu_opencl.h>
+#include "../helper.h"
+#include "scal.h"
+
+struct starpu_codelet mycodelet =
+{
+        .where = STARPU_CPU
+#ifdef STARPU_USE_CUDA
+		| STARPU_CUDA
+#endif
+#ifdef STARPU_USE_OPENCL
+		| STARPU_OPENCL
+#endif
+		,
+	.cpu_funcs = { scal_func_cpu, NULL },
+#ifdef STARPU_USE_OPENCL
+	.opencl_funcs = { scal_func_opencl, NULL },
+#endif
+#ifdef STARPU_USE_CUDA
+	.cuda_funcs = { scal_func_cuda, NULL },
+#endif
+	.modes = { STARPU_W },
+        .model = NULL,
+        .nbuffers = 1
+};
+
+int main(int argc, char **argv)
+{
+	unsigned *foo;
+	starpu_data_handle_t handle;
+	int ret;
+	int n, i, size;
+
+	ret = starpu_init(NULL);
+	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+
+#ifdef STARPU_USE_OPENCL
+	ret = starpu_opencl_load_opencl_from_file("tests/datawizard/scal_opencl.cl", &opencl_program, NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_opencl_load_opencl_from_file");
+#endif
+
+	n = starpu_worker_get_count();
+	size = 10 * n;
+
+	starpu_vector_data_register(&handle, -1, (uintptr_t)NULL, size, sizeof(*foo));
+
+	struct starpu_data_filter f =
+	{
+		.filter_func = starpu_block_filter_func_vector,
+		.nchildren = n > 1 ? n : 2,
+	};
+
+	starpu_data_partition(handle, &f);
+
+	for (i = 0; i < f.nchildren; i++) {
+		ret = starpu_insert_task(&mycodelet,
+					 STARPU_W,
+					 starpu_data_get_sub_data(handle, 1, i),
+					 0);
+		if (ret == -ENODEV) goto enodev;
+		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	}
+
+	ret = starpu_task_wait_for_all();
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait_for_all");
+
+	starpu_data_unpartition(handle, 0);
+	starpu_data_unregister(handle);
+	starpu_shutdown();
+
+        return 0;
+
+enodev:
+	starpu_data_unregister(handle);
+	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 STARPU_TEST_SKIPPED;
+}