Browse Source

data interface: define the value STARPU_UNKNOWN_INTERFACE_ID to be used by newly defined user-defined data interfaces

Nathalie Furmento 12 years ago
parent
commit
f8c037df9d

+ 2 - 2
doc/chapters/advanced-api.texi

@@ -462,7 +462,7 @@ void starpu_complex_data_register(starpu_data_handle_t *handle,
                 .nx = nx
                 .nx = nx
         @};
         @};
 
 
-        if (interface_complex_ops.interfaceid == -1)
+        if (interface_complex_ops.interfaceid == STARPU_UNKNOWN_INTERFACE_ID)
         @{
         @{
                 interface_complex_ops.interfaceid = starpu_data_interface_get_next_id();
                 interface_complex_ops.interfaceid = starpu_data_interface_get_next_id();
         @}
         @}
@@ -488,7 +488,7 @@ static struct starpu_data_interface_ops interface_complex_ops =
         .copy_methods = &complex_copy_methods,
         .copy_methods = &complex_copy_methods,
         .get_size = complex_get_size,
         .get_size = complex_get_size,
         .footprint = complex_footprint,
         .footprint = complex_footprint,
-        .interfaceid = -1,
+        .interfaceid = STARPU_UNKNOWN_INTERFACE_ID,
         .interface_size = sizeof(struct starpu_complex_interface),
         .interface_size = sizeof(struct starpu_complex_interface),
 @};
 @};
 @end smallexample
 @end smallexample

+ 3 - 2
examples/filters/custom_mf/custom_interface.c

@@ -98,7 +98,7 @@ static struct starpu_data_interface_ops interface_custom_ops =
 	.get_size              = custom_interface_get_size,
 	.get_size              = custom_interface_get_size,
 	.footprint             = footprint_custom_interface_crc32,
 	.footprint             = footprint_custom_interface_crc32,
 	.compare               = NULL,
 	.compare               = NULL,
-	.interfaceid           = -1,
+	.interfaceid           = STARPU_UNKNOWN_INTERFACE_ID,
 	.interface_size        = sizeof(struct custom_data_interface),
 	.interface_size        = sizeof(struct custom_data_interface),
 	.display               = display_custom_interface,
 	.display               = display_custom_interface,
 	.is_multiformat        = 1,
 	.is_multiformat        = 1,
@@ -276,7 +276,8 @@ void custom_data_register(starpu_data_handle_t *handle,
 		.ops = format_ops
 		.ops = format_ops
 	};
 	};
 
 
-	if (interface_custom_ops.interfaceid == -1) {
+	if (interface_custom_ops.interfaceid == STARPU_UNKNOWN_INTERFACE_ID)
+	{
 		interface_custom_ops.interfaceid = starpu_data_interface_get_next_id();
 		interface_custom_ops.interfaceid = starpu_data_interface_get_next_id();
 	}
 	}
 	starpu_data_register(handle, home_node, &custom, &interface_custom_ops);
 	starpu_data_register(handle, home_node, &custom, &interface_custom_ops);

+ 2 - 2
examples/interface/complex_interface.c

@@ -289,7 +289,7 @@ static struct starpu_data_interface_ops interface_complex_ops =
 	.copy_methods = &complex_copy_methods,
 	.copy_methods = &complex_copy_methods,
 	.get_size = complex_get_size,
 	.get_size = complex_get_size,
 	.footprint = complex_footprint,
 	.footprint = complex_footprint,
-	.interfaceid = -1,
+	.interfaceid = STARPU_UNKNOWN_INTERFACE_ID,
 	.interface_size = sizeof(struct starpu_complex_interface),
 	.interface_size = sizeof(struct starpu_complex_interface),
 	.handle_to_pointer = complex_handle_to_pointer,
 	.handle_to_pointer = complex_handle_to_pointer,
 	.pack_data = complex_pack_data,
 	.pack_data = complex_pack_data,
@@ -305,7 +305,7 @@ void starpu_complex_data_register(starpu_data_handle_t *handleptr, unsigned home
 		.nx = nx
 		.nx = nx
 	};
 	};
 
 
-	if (interface_complex_ops.interfaceid == -1)
+	if (interface_complex_ops.interfaceid == STARPU_UNKNOWN_INTERFACE_ID)
 	{
 	{
 		interface_complex_ops.interfaceid = starpu_data_interface_get_next_id();
 		interface_complex_ops.interfaceid = starpu_data_interface_get_next_id();
 	}
 	}

+ 1 - 0
include/starpu_data_interfaces.h

@@ -81,6 +81,7 @@ int starpu_interface_copy(uintptr_t src, size_t src_offset, unsigned src_node, u
 
 
 enum starpu_data_interface_id
 enum starpu_data_interface_id
 {
 {
+	STARPU_UNKNOWN_INTERFACE_ID = -1,
 	STARPU_MATRIX_INTERFACE_ID=0,
 	STARPU_MATRIX_INTERFACE_ID=0,
 	STARPU_BLOCK_INTERFACE_ID=1,
 	STARPU_BLOCK_INTERFACE_ID=1,
 	STARPU_VECTOR_INTERFACE_ID=2,
 	STARPU_VECTOR_INTERFACE_ID=2,