Parcourir la source

check the field interfaceid is set when registering a data

Nathalie Furmento il y a 4 ans
Parent
commit
0f23b464b1

+ 6 - 1
examples/cpp/add_vectors_interface.cpp

@@ -375,7 +375,7 @@ static void register_vector_cpp_handle(starpu_data_handle_t handle, unsigned hom
 
 /* declare a new data with the vector interface */
 void vector_cpp_data_register(starpu_data_handle_t *handleptr, int home_node,
-                        std::vector<MY_TYPE>* vec, uint32_t nx, size_t elemsize)
+			      std::vector<MY_TYPE>* vec, uint32_t nx, size_t elemsize)
 {
 #if __cplusplus >= 201103L
 	struct vector_cpp_interface vector =
@@ -403,6 +403,11 @@ void vector_cpp_data_register(starpu_data_handle_t *handleptr, int home_node,
 	};
 #endif
 
+	if (interface_vector_cpp_ops.interfaceid == STARPU_UNKNOWN_INTERFACE_ID)
+	{
+		interface_vector_cpp_ops.interfaceid = (enum starpu_data_interface_id )starpu_data_interface_get_next_id();
+	}
+
 	starpu_data_register(handleptr, home_node, &vector, &interface_vector_cpp_ops);
 }
 

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

@@ -548,6 +548,9 @@ void starpu_data_register(starpu_data_handle_t *handleptr, int home_node,
 	STARPU_ASSERT(handleptr);
 	*handleptr = handle;
 
+	/* check the interfaceid is set */
+	STARPU_ASSERT(ops->interfaceid != STARPU_UNKNOWN_INTERFACE_ID);
+
 	/* fill the interface fields with the appropriate method */
 	STARPU_ASSERT(ops->register_data_handle);
 	ops->register_data_handle(handle, home_node, data_interface);