Przeglądaj źródła

Add starpu_data_set/get_ooc_flag

Samuel Thibault 6 lat temu
rodzic
commit
c86f60990f

+ 1 - 0
ChangeLog

@@ -144,6 +144,7 @@ StarPU 1.2.7 (git revision xxx)
 
 Small features:
   * Add STARPU_HWLOC_INPUT environment variable to save initialization time.
+  * Add starpu_data_set/get_ooc_flag.
 
 StarPU 1.2.6 (git revision 23049adea01837479f309a75c002dacd16eb34ad)
 ==============================================

+ 4 - 0
doc/doxygen/chapters/401_out_of_core.doxy

@@ -106,6 +106,10 @@ Which makes StarPU automatically do the allocation when the task running
 cl_fill_with_data gets executed. And then if its needs to, it will be able to
 release it after having pushed the data to the disk.
 
+By default, StarPU will try to push any data handle to the disk. 
+To specify whether a given handle should be pushed to the disk,
+starpu_data_set_ooc_flag() should be used.
+
 \section OOCWontUse Using Wont Use
 
 By default, StarPU uses a Least-Recently-Used (LRU) algorithm to determine

+ 11 - 1
doc/doxygen/chapters/api/data_management.doxy

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2011,2012,2017                           Inria
  * Copyright (C) 2010-2018                                CNRS
- * Copyright (C) 2009-2011,2014-2017                      Université de Bordeaux
+ * Copyright (C) 2009-2011,2014-2017,2019                 Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -206,6 +206,16 @@ Set the coordinates of the data, to be shown in various profiling tools.
 \p dimensions is the number of subsequent \c int parameters.
 This can be for instance the tile coordinates within a big matrix.
 
+\fn void starpu_data_set_ooc_flag(starpu_data_handle_t handle, unsigned flag)
+\ingroup API_Data_Management
+Set whether this data should be elligible to be evicted to disk storage (1) or
+not (0). The default is 1.
+
+\fn unsigned starpu_data_get_ooc_flag(starpu_data_handle_t handle)
+\ingroup API_Data_Management
+Get whether this data was set to be elligible to be evicted to disk storage (1) or
+not (0).
+
 \fn int starpu_data_fetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async)
 \ingroup API_Data_Management
 Issue a fetch request for the data \p handle to \p node, i.e.

+ 4 - 1
include/starpu_data.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2018                                Université de Bordeaux
+ * Copyright (C) 2009-2019                                Université de Bordeaux
  * Copyright (C) 2011-2013,2016,2017                      Inria
  * Copyright (C) 2010-2015,2017                           CNRS
  *
@@ -146,6 +146,9 @@ unsigned starpu_data_get_sequential_consistency_flag(starpu_data_handle_t handle
 unsigned starpu_data_get_default_sequential_consistency_flag(void);
 void starpu_data_set_default_sequential_consistency_flag(unsigned flag);
 
+void starpu_data_set_ooc_flag(starpu_data_handle_t handle, unsigned flag);
+unsigned starpu_data_get_ooc_flag(starpu_data_handle_t handle);
+
 void starpu_data_query_status(starpu_data_handle_t handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
 
 struct starpu_codelet;

+ 3 - 1
src/datawizard/coherency.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2008-2018                                Université de Bordeaux
+ * Copyright (C) 2008-2019                                Université de Bordeaux
  * Copyright (C) 2011,2013-2017                           Inria
  * Copyright (C) 2010-2015,2017,2018                      CNRS
  *
@@ -199,6 +199,8 @@ struct _starpu_data_state
 	unsigned sequential_consistency;
 	/* Is the data initialized, or a task is already submitted to initialize it */
 	unsigned initialized;
+	/* Can the data be pushed to the disk? */
+	unsigned ooc;
 
 	/* This lock should protect any operation to enforce
 	 * sequential_consistency */

+ 2 - 1
src/datawizard/filters.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2011,2012,2016,2017                      Inria
  * Copyright (C) 2011                                     Antoine Lucas
- * Copyright (C) 2008-2018                                Université de Bordeaux
+ * Copyright (C) 2008-2019                                Université de Bordeaux
  * Copyright (C) 2010                                     Mehdi Juhoor
  * Copyright (C) 2010-2013,2015-2018                      CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
@@ -272,6 +272,7 @@ static void _starpu_data_partition(starpu_data_handle_t initial_handle, starpu_d
 
 		child->sequential_consistency = initial_handle->sequential_consistency;
 		child->initialized = initial_handle->initialized;
+		child->ooc = initial_handle->ooc;
 
 		STARPU_PTHREAD_MUTEX_INIT(&child->sequential_consistency_mutex, NULL);
 		child->last_submitted_mode = STARPU_R;

+ 2 - 1
src/datawizard/interfaces/data_interface.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2017                                Inria
- * Copyright (C) 2009-2018                                Université de Bordeaux
+ * Copyright (C) 2009-2019                                Université de Bordeaux
  * Copyright (C) 2010-2018                                CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -298,6 +298,7 @@ static void _starpu_register_new_data(starpu_data_handle_t handle,
 	handle->sequential_consistency =
 		starpu_data_get_default_sequential_consistency_flag();
 	handle->initialized = home_node != -1;
+	handle->ooc = 1;
 
 	STARPU_PTHREAD_MUTEX_INIT(&handle->sequential_consistency_mutex, NULL);
 	handle->last_submitted_mode = STARPU_R;

+ 5 - 1
src/datawizard/memalloc.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2013,2016,2017                      Inria
- * Copyright (C) 2008-2018                                Université de Bordeaux
+ * Copyright (C) 2008-2019                                Université de Bordeaux
  * Copyright (C) 2018                                     Federal University of Rio Grande do Sul (UFRGS)
  * Copyright (C) 2010-2017                                CNRS
  *
@@ -504,6 +504,10 @@ static size_t try_to_throw_mem_chunk(struct _starpu_mem_chunk *mc, unsigned node
 	if ((int) node == handle->home_node)
 		return 0;
 
+	/* This data cannnot be pushed outside CPU memory */
+	if (!handle->ooc && starpu_node_get_kind(node) == STARPU_CPU_RAM)
+		return 0;
+
 	if (diduse_barrier && !mc->diduse)
 		/* Hasn't been used yet, avoid evicting it */
 		return 0;

+ 11 - 1
src/datawizard/user_interactions.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2013,2017                           Inria
- * Copyright (C) 2009-2018                                Université de Bordeaux
+ * Copyright (C) 2009-2019                                Université de Bordeaux
  * Copyright (C) 2010-2013,2015-2018                      CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -693,6 +693,16 @@ unsigned starpu_data_get_sequential_consistency_flag(starpu_data_handle_t handle
 	return handle->sequential_consistency;
 }
 
+void starpu_data_set_ooc_flag(starpu_data_handle_t handle, unsigned flag)
+{
+	handle->ooc = flag;
+}
+
+unsigned starpu_data_get_ooc_flag(starpu_data_handle_t handle)
+{
+	return handle->ooc;
+}
+
 /* By default, sequential consistency is enabled */
 static unsigned default_sequential_consistency_flag = 1;