Browse Source

remove starpu_data_partition_not_automatic()

Nathalie Furmento 4 years ago
parent
commit
4fa9a60571

+ 0 - 1
examples/Makefile.am

@@ -243,7 +243,6 @@ STARPU_EXAMPLES +=				\
 	filters/fmultiple_submit_readonly	\
 	filters/fmultiple_submit_implicit	\
 	filters/frecursive			\
-	filters/fplan_notautomatic		\
 	tag_example/tag_example			\
 	tag_example/tag_example2		\
 	tag_example/tag_example3		\

+ 0 - 244
examples/filters/fplan_notautomatic.c

@@ -1,244 +0,0 @@
-/* StarPU --- Runtime system for heterogeneous multicore architectures.
- *
- * Copyright (C) 2018-2021  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
- *
- * 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>
-
-#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
-
-#define NX    9
-#define PARTS 3
-
-struct starpu_codelet task_codelet;
-
-// CPU implementations
-void task_cpu(void *descr[], void *args)
-{
-	int *values = (int*)STARPU_VECTOR_GET_PTR(descr[0]);
-	int nx = STARPU_VECTOR_GET_NX(descr[0]);
-	int i, add;
-	char message[10000];
-	int cur = 0;
-
-	starpu_codelet_unpack_args(args, &add);
-
-	cur += snprintf(&message[cur], 10000-cur, "Values ");
-	for(i=0 ; i<nx ; i++)
-	{
-		values[i] += add;
-		cur += snprintf(&message[cur], 10000-cur, "%d ", values[i]);
-	}
-	FPRINTF(stderr, "%s\n", message);
-}
-
-void split_callback(void *arg)
-{
-	(void)arg;
-	struct starpu_task *task = starpu_task_get_current();
-	starpu_data_handle_t value_handle, sub_handles[PARTS];
-
-	starpu_codelet_unpack_args(task->cl_arg, &value_handle, &sub_handles);
-
-	FPRINTF(stderr, "[callback] Partition for handle %p into handles %p %p and %p\n", value_handle, sub_handles[0], sub_handles[1], sub_handles[2]);
-
-	starpu_data_partition_submit_sequential_consistency(value_handle, PARTS, sub_handles, 0);
-}
-
-void supertask_callback(void *arg)
-{
-	(void)arg;
-	starpu_data_handle_t sub_handles[PARTS];
-	int add;
-	struct starpu_task *task = starpu_task_get_current();
-
-	starpu_codelet_unpack_args(task->cl_arg, &sub_handles, &add);
-
-	FPRINTF(stderr, "Submitting tasks on %d subdata (add %d)\n", PARTS, add);
-
-	int i;
-	for(i=0 ; i<PARTS ; i++)
-	{
-		int ret = starpu_task_insert(&task_codelet,
-					     STARPU_RW, sub_handles[i],
-					     STARPU_VALUE, &add, sizeof(add),
-					     0);
-		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
-	}
-}
-
-void release(void *arg)
-{
-	struct starpu_task *task = (struct starpu_task *)arg;
-	starpu_task_end_dep_release(task);
-}
-
-void merge_callback(void *arg)
-{
-	(void)arg;
-	struct starpu_task *task = starpu_task_get_current();
-
-	starpu_data_handle_t value_handle, sub_handles[PARTS];
-	starpu_codelet_unpack_args(task->cl_arg, &value_handle, &sub_handles);
-
-	FPRINTF(stderr, "Unpartition for handle %p from handles %p %p and %p\n", value_handle, sub_handles[0], sub_handles[1], sub_handles[2]);
-
-	starpu_data_unpartition_submit_sequential_consistency_cb(value_handle, PARTS, sub_handles, STARPU_MAIN_RAM, 0, release, task);
-}
-
-// Codelets
-struct starpu_codelet task_codelet =
-{
-	.cpu_funcs = {task_cpu},
-	.nbuffers = 1,
-	.modes = {STARPU_RW},
-	.name = "task_codelet"
-};
-
-struct starpu_codelet supertask_codelet =
-{
-	.where= STARPU_NOWHERE,
-	.nbuffers = 1,
-	.modes = {STARPU_RW},
-	.name = "supertask_codelet"
-};
-
-struct starpu_codelet split_codelet =
-{
-	.where= STARPU_NOWHERE,
-	.nbuffers = 1,
-	.modes = {STARPU_RW},
-	.name = "split_codelet"
-};
-
-struct starpu_codelet merge_codelet =
-{
-	.where= STARPU_NOWHERE,
-	.nbuffers = 1,
-	.modes = {STARPU_RW},
-	.name = "merge_codelet"
-};
-
-int main(void)
-{
-	int ret, i;
-	int values[NX];
-	int check[NX];
-	int add1=1;
-	int add2=2;
-	starpu_data_handle_t value_handle;
-	starpu_data_handle_t sub_handles[PARTS];
-
-	ret = starpu_init(NULL);
-	if (ret == -ENODEV)
-		exit(77);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
-
-	if (starpu_cpu_worker_get_count() == 0)
-	{
-		FPRINTF(stderr, "We need at least 1 CPU worker.\n");
-		starpu_shutdown();
-		return 77;
-	}
-
-	struct starpu_data_filter f =
-	{
-		.filter_func = starpu_vector_filter_block,
-		.nchildren = PARTS
-	};
-
-	values[NX-1] = 2;
-	for(i=NX-2 ; i>= 0 ; i--) values[i] = values[i+1] * 2;
-	for(i=0 ; i<NX ; i++) check[i] = values[i] + (2 * add1) + (2 * add2);
-
-	starpu_vector_data_register(&value_handle, STARPU_MAIN_RAM, (uintptr_t)&values[0], NX, sizeof(values[0]));
-	starpu_data_partition_plan(value_handle, &f, sub_handles);
-
-	// tell StarPU not to partition data, the application will decide itself when to do it
-	starpu_data_partition_not_automatic(value_handle);
-	for(i=0 ; i<PARTS ; i++)
-		starpu_data_partition_not_automatic(sub_handles[i]);
-
-	// insert a task on the whole data
-	ret = starpu_task_insert(&task_codelet, STARPU_RW, value_handle,
-				 STARPU_VALUE, &add1, sizeof(add1),
-				 STARPU_NAME, "task_1", 0);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
-
-	// insert a task to split the data
-	ret = starpu_task_insert(&split_codelet, STARPU_RW, value_handle,
-				 STARPU_VALUE, &value_handle, sizeof(starpu_data_handle_t),
-				 STARPU_VALUE, sub_handles, PARTS*sizeof(starpu_data_handle_t),
-				 STARPU_NAME, "split",
-				 STARPU_PROLOGUE_CALLBACK, split_callback,
-				 0);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
-
-	// insert a task that will work on the subdata
-	ret = starpu_task_insert(&supertask_codelet, STARPU_RW, value_handle,
-				 STARPU_VALUE, sub_handles, PARTS*sizeof(starpu_data_handle_t),
-				 STARPU_VALUE, &add1, sizeof(add1),
-				 STARPU_NAME, "supertask_1",
-				 STARPU_PROLOGUE_CALLBACK, supertask_callback,
-				 0);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
-
-	// insert another task that will work on the subdata
-	ret = starpu_task_insert(&supertask_codelet, STARPU_RW, value_handle,
-				 STARPU_VALUE, sub_handles, PARTS*sizeof(starpu_data_handle_t),
-				 STARPU_VALUE, &add2, sizeof(add2),
-				 STARPU_NAME, "supertask_2",
-				 STARPU_PROLOGUE_CALLBACK, supertask_callback,
-				 0);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
-
-	// insert a task to merge the data
-	ret = starpu_task_insert(&merge_codelet, STARPU_RW, value_handle,
-				 STARPU_VALUE, &value_handle, sizeof(starpu_data_handle_t),
-				 STARPU_VALUE, sub_handles, PARTS*sizeof(starpu_data_handle_t),
-				 STARPU_NAME, "merge",
-				 STARPU_PROLOGUE_CALLBACK, merge_callback,
-				 STARPU_TASK_END_DEP, 1,
-				 0);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
-
-	// insert a task that will work on the whole data
-	ret = starpu_task_insert(&task_codelet, STARPU_RW, value_handle,
-				 STARPU_VALUE, &add2, sizeof(add2),
-				 STARPU_NAME, "task_2", 0);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
-
-	starpu_task_wait_for_all();
-	starpu_data_partition_clean(value_handle, PARTS, sub_handles);
-	starpu_data_unregister(value_handle);
-
-	FPRINTF(stderr, "Values : ");
-	for(i=0 ; i<NX ; i++)
-	{
-		FPRINTF(stderr, "%d ", values[i]);
-	}
-	FPRINTF(stderr, "\n");
-	for(i=0 ; i<NX ; i++)
-	{
-		if (values[i] != check[i])
-		{
-			FPRINTF(stderr, "Incorrect value for %d. %d != %d\n", i, values[i], check[i]);
-			ret = 1;
-		}
-	}
-
-	starpu_shutdown();
-
-	return ret;
-}

+ 0 - 6
include/starpu_data_filters.h

@@ -301,12 +301,6 @@ void starpu_data_partition_submit_sequential_consistency(starpu_data_handle_t in
 */
 void starpu_data_unpartition_submit_sequential_consistency(starpu_data_handle_t initial_handle, unsigned nparts, starpu_data_handle_t *children, int gathering_node, int sequential_consistency);
 
-/**
-   Disable the automatic partitioning of the data \p handle for which
-   a asynchronous plan has previously been submitted
-*/
-void starpu_data_partition_not_automatic(starpu_data_handle_t handle);
-
 /** @} */
 
 /**

+ 0 - 1
src/core/task.c

@@ -795,7 +795,6 @@ static int _starpu_task_submit_head(struct starpu_task *task)
 				_STARPU_TASK_SET_INTERFACE(task, starpu_data_get_interface_on_node(handle, handle->home_node), i);
 			if (!(task->cl->flags & STARPU_CODELET_NOPLANS) &&
 			    ((handle->nplans && !handle->nchildren) || handle->siblings)
-			    && handle->partition_automatic_disabled == 0
 			    && !(mode & STARPU_NOPLAN))
 				/* This handle is involved with asynchronous
 				 * partitioning as a parent or a child, make

+ 0 - 3
src/datawizard/coherency.h

@@ -226,9 +226,6 @@ struct _starpu_data_state
 	/** Can the data be pushed to the disk? */
 	unsigned ooc:1;
 
-	/** Whether automatic planned partitioning/unpartitioning should not be done */
-	int partition_automatic_disabled:1;
-
 #ifdef STARPU_OPENMP
 	unsigned removed_from_context_hash:1;
 #endif

+ 0 - 5
src/datawizard/filters.c

@@ -1066,8 +1066,3 @@ starpu_filter_nparts_compute_chunk_size_and_offset(unsigned n, unsigned nparts,
 	if (offset != NULL)
 		*offset = (id *(n/nparts) + STARPU_MIN(remainder, id)) * ld * elemsize;
 }
-
-void starpu_data_partition_not_automatic(starpu_data_handle_t handle)
-{
-	handle->partition_automatic_disabled = 1;
-}

+ 1 - 3
src/datawizard/interfaces/data_interface.c

@@ -486,7 +486,6 @@ int _starpu_data_handle_init(starpu_data_handle_t handle, struct starpu_data_int
 	//handle->readonly
 	//handle->ooc
 	//handle->lazy_unregister = 0;
-	//handle->partition_automatic_disabled = 0;
 	//handle->removed_from_context_hash = 0;
 
 	STARPU_PTHREAD_MUTEX_INIT0(&handle->sequential_consistency_mutex, NULL);
@@ -886,8 +885,7 @@ static void _starpu_data_unregister(starpu_data_handle_t handle, unsigned cohere
 		STARPU_ASSERT_MSG(_starpu_worker_may_perform_blocking_calls(), "starpu_data_unregister must not be called from a task or callback, perhaps you can use starpu_data_unregister_submit instead");
 
 		/* If sequential consistency is enabled, wait until data is available */
-		if (((handle->nplans && !handle->nchildren) || handle->siblings)
-			&& handle->partition_automatic_disabled == 0)
+		if ((handle->nplans && !handle->nchildren) || handle->siblings)
 			_starpu_data_partition_access_submit(handle, !handle->readonly);
 		_starpu_data_wait_until_available(handle, handle->readonly?STARPU_R:STARPU_RW, "starpu_data_unregister");
 	}

+ 0 - 1
src/datawizard/user_interactions.c

@@ -28,7 +28,6 @@
 static void _starpu_data_check_initialized(starpu_data_handle_t handle, enum starpu_data_access_mode mode)
 {
 	if (((handle->nplans && !handle->nchildren) || handle->siblings)
-		&& handle->partition_automatic_disabled == 0
 		&& !(mode & STARPU_NOPLAN))
 	{
 		_starpu_data_partition_access_submit(handle, (mode & STARPU_W) != 0);