Browse Source

Fix freeing packed data after MPI send

Samuel Thibault 5 years ago
parent
commit
92a477cf4a

+ 1 - 1
examples/cpp/add_vectors_interface.cpp

@@ -450,7 +450,7 @@ static int pack_vector_cpp_handle(starpu_data_handle_t handle, unsigned node, vo
 
 	if (ptr != NULL)
 	{
-		starpu_malloc_flags(ptr, *count, 0);
+		*ptr = (void*) starpu_malloc_on_node_flags(node, *count, 0);
 		memcpy(*ptr, (void*)vector_interface->ptr, vector_interface->elemsize*vector_interface->nx);
 	}
 

+ 1 - 1
examples/interface/complex_interface.c

@@ -138,7 +138,7 @@ static int complex_pack_data(starpu_data_handle_t handle, unsigned node, void **
 	if (ptr != NULL)
 	{
 		char *data;
-		starpu_malloc_flags((void**) &data, *count, 0);
+		data = (void*) starpu_malloc_on_node_flags(node, *count, 0);
 		*ptr = data;
 		memcpy(data, complex_interface->real, complex_interface->nx*sizeof(double));
 		memcpy(data+complex_interface->nx*sizeof(double), complex_interface->imaginary, complex_interface->nx*sizeof(double));

+ 1 - 1
mpi/src/mpi/starpu_mpi_mpi.c

@@ -856,7 +856,7 @@ static void _starpu_mpi_handle_request_termination(struct _starpu_mpi_req *req)
 					int ret;
 					ret = MPI_Wait(&req->backend->size_req, MPI_STATUS_IGNORE);
 					STARPU_MPI_ASSERT_MSG(ret == MPI_SUCCESS, "MPI_Wait returning %s", _starpu_mpi_get_mpi_error_code(ret));
-					free(req->ptr);
+					starpu_free_on_node_flags(STARPU_MAIN_RAM, req->ptr, req->backend->envelope->size, 0);
 					req->ptr = NULL;
 				}
 				else if (req->request_type == RECV_REQ)

+ 1 - 1
mpi/tests/user_defined_datatype_value.h

@@ -98,7 +98,7 @@ static int value_pack_data(starpu_data_handle_t handle, unsigned node, void **pt
 	*count = sizeof(int);
 	if (ptr != NULL)
 	{
-		*ptr = malloc(*count);
+		*ptr = (void*) starpu_malloc_on_node_flags(node, *count, 0);
 		memcpy(*ptr, value_interface->value, sizeof(int));
 	}