瀏覽代碼

port -r21697 from NUMA : Size may be updated after memory allocation. Check and update if it's the wrong size

Corentin Salingue 7 年之前
父節點
當前提交
ef64e6b34b
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      tests/datawizard/variable_size.c

+ 9 - 0
tests/datawizard/variable_size.c

@@ -152,6 +152,15 @@ static int variable_size_copy(void *src_interface, unsigned src_node, void *dst_
 {
 	struct variable_size_interface *src = src_interface;
 	struct variable_size_interface *dst = dst_interface;
+
+	if (src->size != dst->size)
+	{
+		/* size has been changed by the application in the meantime */
+		starpu_free_on_node(dst_node, dst->ptr, dst->size);
+		dst->ptr = starpu_malloc_on_node_flags(dst_node, src->size, STARPU_MALLOC_PINNED | STARPU_MALLOC_COUNT | STARPU_MEMORY_OVERFLOW);
+		dst->size = src->size;
+	}
+
 	return starpu_interface_copy(src->ptr, 0, src_node,
 				    dst->ptr, 0, dst_node,
 				    src->size, async_data);