Przeglądaj źródła

src/datawizard: update function _starpu_data_handle_init() that it also sets the mf_node for the new data handle

Nathalie Furmento 12 lat temu
rodzic
commit
e1d7debf62

+ 1 - 2
src/datawizard/filters.c

@@ -419,8 +419,7 @@ static void starpu_data_create_children(starpu_data_handle_t handle, unsigned nc
 		  ops = handle->ops;
 
 		handle_child = &handle->children[child];
-		_starpu_data_handle_init(handle_child, ops);
-		handle_child->mf_node = handle->mf_node;
+		_starpu_data_handle_init(handle_child, ops, handle->mf_node);
 	}
 
 	/* this handle now has children */

+ 8 - 7
src/datawizard/interfaces/data_interface.c

@@ -228,12 +228,13 @@ static void _starpu_register_new_data(starpu_data_handle_t handle,
 	}
 }
 
-int _starpu_data_handle_init(starpu_data_handle_t handle, struct starpu_data_interface_ops *interface_ops)
+int _starpu_data_handle_init(starpu_data_handle_t handle, struct starpu_data_interface_ops *interface_ops, unsigned int mf_node)
 {
 	unsigned node;
 	unsigned worker;
 
 	handle->ops = interface_ops;
+	handle->mf_node = mf_node;
 
 	size_t interfacesize = interface_ops->interface_size;
 
@@ -271,23 +272,23 @@ int _starpu_data_handle_init(starpu_data_handle_t handle, struct starpu_data_int
 	return 0;
 }
 
-starpu_data_handle_t _starpu_data_handle_allocate(struct starpu_data_interface_ops *interface_ops)
+static
+starpu_data_handle_t _starpu_data_handle_allocate(struct starpu_data_interface_ops *interface_ops, unsigned int mf_node)
 {
 	starpu_data_handle_t handle = (starpu_data_handle_t) calloc(1, sizeof(struct _starpu_data_state));
 	STARPU_ASSERT(handle);
-	_starpu_data_handle_init(handle, interface_ops);
+	_starpu_data_handle_init(handle, interface_ops, mf_node);
 	return handle;
 }
 
 void starpu_data_register(starpu_data_handle_t *handleptr, uint32_t home_node,
-				void *data_interface,
-				struct starpu_data_interface_ops *ops)
+			  void *data_interface,
+			  struct starpu_data_interface_ops *ops)
 {
-	starpu_data_handle_t handle = _starpu_data_handle_allocate(ops);
+	starpu_data_handle_t handle = _starpu_data_handle_allocate(ops, home_node);
 
 	STARPU_ASSERT(handleptr);
 	*handleptr = handle;
-	handle->mf_node = home_node;
 
 	int asynchronous_copy_disabled = starpu_asynchronous_copy_disabled();
 	if (STARPU_UNLIKELY(asynchronous_copy_disabled))

+ 1 - 1
src/datawizard/interfaces/data_interface.h

@@ -27,7 +27,7 @@ void _starpu_data_free_interfaces(starpu_data_handle_t handle)
 	STARPU_ATTRIBUTE_INTERNAL;
 
 extern
-int _starpu_data_handle_init(starpu_data_handle_t handle, struct starpu_data_interface_ops *interface_ops);
+int _starpu_data_handle_init(starpu_data_handle_t handle, struct starpu_data_interface_ops *interface_ops, unsigned int mf_node);
 
 extern void _starpu_data_interface_init(void) STARPU_ATTRIBUTE_INTERNAL;
 extern int _starpu_data_check_not_busy(starpu_data_handle_t handle) STARPU_ATTRIBUTE_INTERNAL;