Browse Source

Add get_max_size method to data interfaces for applications using data with
variable size to express their maximal potential size.

Samuel Thibault 6 years ago
parent
commit
857c5b52a0

+ 2 - 0
ChangeLog

@@ -20,6 +20,8 @@ StarPU 1.4.0 (svn revision xxxx)
 ==============================================
 New features:
   * Fault tolerance support with starpu_task_ft_failed().
+  * Add get_max_size method to data interfaces for applications using data with
+    variable size to express their maximal potential size.
 
 StarPU 1.3.3 (git revision xxx)
 ==============================================

+ 13 - 0
include/starpu_data_interfaces.h

@@ -456,6 +456,14 @@ struct starpu_data_interface_ops
 	size_t 		 (*get_alloc_size)		(starpu_data_handle_t handle);
 
 	/**
+	   Return the maximum size that the data may need to increase to. For
+	   instance, in the case of compressed matrix tiles this is the size
+	   when the block is fully dense.
+	   This is currently only used for feedback tools.
+	*/
+	size_t 		 (*get_max_size)		(starpu_data_handle_t handle);
+
+	/**
 	  Return a 32bit footprint which characterizes the data size and layout (nx, ny, ld, elemsize, etc.), required for indexing performance models.
 
 	  starpu_hash_crc32c_be() and alike can be used to produce this 32bit value from various types of values.
@@ -656,6 +664,11 @@ size_t starpu_data_get_size(starpu_data_handle_t handle);
 size_t starpu_data_get_alloc_size(starpu_data_handle_t handle);
 
 /**
+   Return the maximum size that the \p handle data may need to increase to.
+*/
+starpu_ssize_t starpu_data_get_max_size(starpu_data_handle_t handle);
+
+/**
    Return the handle corresponding to the data pointed to by the \p ptr host pointer.
 */
 starpu_data_handle_t starpu_data_lookup(const void *ptr);

+ 4 - 3
src/common/fxt.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2017                                Inria
- * Copyright (C) 2008-2018                                Université de Bordeaux
+ * Copyright (C) 2008-2019                                Université de Bordeaux
  * Copyright (C) 2013                                     Joris Pablo
  * Copyright (C) 2018                                     Federal University of Rio Grande do Sul (UFRGS)
  * Copyright (C) 2010-2019                                CNRS
@@ -1106,13 +1106,14 @@ do {										\
 
 #define _STARPU_TRACE_HANDLE_DATA_REGISTER(handle)	do {	\
 	const size_t __data_size = handle->ops->get_size(handle); \
-	char __buf[(FXT_MAX_PARAMS-2)*sizeof(long)]; \
+	const starpu_ssize_t __max_data_size = _starpu_data_get_max_size(handle); \
+	char __buf[(FXT_MAX_PARAMS-4)*sizeof(long)]; \
 	void *__interface = handle->per_node[0].data_interface; \
 	if (handle->ops->describe) \
 		handle->ops->describe(__interface, __buf, sizeof(__buf)); \
 	else \
 		__buf[0] = 0; \
-	FUT_DO_PROBE3STR(_STARPU_FUT_HANDLE_DATA_REGISTER, handle, __data_size, handle->home_node, __buf); \
+	FUT_DO_PROBE4STR(_STARPU_FUT_HANDLE_DATA_REGISTER, handle, __data_size, __max_data_size, handle->home_node, __buf); \
 } while (0)
 
 #define _STARPU_TRACE_HANDLE_DATA_UNREGISTER(handle)	\

+ 8 - 0
src/datawizard/coherency.c

@@ -814,6 +814,14 @@ size_t _starpu_data_get_alloc_size(starpu_data_handle_t handle)
 		return handle->ops->get_size(handle);
 }
 
+starpu_ssize_t _starpu_data_get_max_size(starpu_data_handle_t handle)
+{
+	if (handle->ops->get_max_size)
+		return handle->ops->get_max_size(handle);
+	else
+		return -1;
+}
+
 uint32_t _starpu_data_get_footprint(starpu_data_handle_t handle)
 {
 	return handle->footprint;

+ 1 - 0
src/datawizard/coherency.h

@@ -307,6 +307,7 @@ uint32_t _starpu_get_data_refcnt(struct _starpu_data_state *state, unsigned node
 
 size_t _starpu_data_get_size(starpu_data_handle_t handle);
 size_t _starpu_data_get_alloc_size(starpu_data_handle_t handle);
+starpu_ssize_t _starpu_data_get_max_size(starpu_data_handle_t handle);
 
 uint32_t _starpu_data_get_footprint(starpu_data_handle_t handle);
 

+ 7 - 2
src/debug/traces/starpu_fxt.c

@@ -274,6 +274,7 @@ struct data_info
 	unsigned long handle;
 	char *name;
 	size_t size;
+	starpu_ssize_t max_size;
 	char *description;
 	unsigned dimensions;
 	unsigned long *dims;
@@ -295,6 +296,7 @@ static struct data_info *get_data(unsigned long handle, int mpi_rank)
 		data->handle = handle;
 		data->name = NULL;
 		data->size = 0;
+		data->max_size = -1;
 		data->description = 0;
 		data->dimensions = 0;
 		data->dims = NULL;
@@ -323,6 +325,8 @@ static void data_dump(struct data_info *data)
 		free(data->name);
 	}
 	fprintf(data_file, "Size: %lu\n", (unsigned long) data->size);
+	if (data->max_size != -1)
+		fprintf(data_file, "MaxSize: %lu\n", (unsigned long) data->max_size);
 	if (data->description)
 	{
 		fprintf(data_file, "Description: %s\n", data->description);
@@ -2083,10 +2087,11 @@ static void handle_data_register(struct fxt_ev_64 *ev, struct starpu_fxt_options
 	unsigned long handle = ev->param[0];
 	char *prefix = options->file_prefix;
 	struct data_info *data = get_data(handle, options->file_rank);
-	char *description = get_fxt_string(ev, 3);
+	char *description = get_fxt_string(ev, 4);
 
 	data->size = ev->param[1];
-	data->home_node = ev->param[2];
+	data->max_size = ev->param[2];
+	data->home_node = ev->param[3];
 	if (description[0])
 		data->description = strdup(description);
 

+ 7 - 1
tests/datawizard/variable_size.c

@@ -116,6 +116,11 @@ static size_t variable_size_get_size(starpu_data_handle_t handle)
 	return interface->size;
 }
 
+static size_t variable_size_get_max_size(starpu_data_handle_t handle)
+{
+	return FULLSIZE;
+}
+
 static uint32_t variable_size_footprint(starpu_data_handle_t handle)
 {
 	return starpu_hash_crc32c_be(variable_size_get_size(handle), 0);
@@ -195,6 +200,7 @@ static struct starpu_data_interface_ops starpu_interface_variable_size_ops =
 	.free_data_on_node = free_variable_size_on_node,
 	.copy_methods = &variable_size_copy_data_methods,
 	.get_size = variable_size_get_size,
+	.get_max_size = variable_size_get_max_size,
 	.footprint = variable_size_footprint,
 	.compare = variable_size_compare,
 	.interfaceid = STARPU_UNKNOWN_INTERFACE_ID,
@@ -290,7 +296,7 @@ int main(void)
 	setenv("STARPU_LIMIT_CPU_MEM", LIMIT, 1);
 	setenv("STARPU_DISK_SWAP", s, 0);
 	setenv("STARPU_DISK_SWAP_SIZE", "100000", 1);
-#ifdef STARPU_LINUX_SYS
+#if 0 //def STARPU_LINUX_SYS
 	setenv("STARPU_DISK_SWAP_BACKEND", "unistd_o_direct", 0);
 #else
 	setenv("STARPU_DISK_SWAP_BACKEND", "unistd", 0);