Quellcode durchsuchen

mpi: new function to enable and disable the communication cache at runtime

Nathalie Furmento vor 10 Jahren
Ursprung
Commit
d3ba5ebc60
4 geänderte Dateien mit 27 neuen und 3 gelöschten Zeilen
  1. 3 1
      ChangeLog
  2. 5 2
      doc/doxygen/chapters/api/mpi.doxy
  3. 1 0
      mpi/include/starpu_mpi.h
  4. 18 0
      mpi/src/starpu_mpi_cache.c

+ 3 - 1
ChangeLog

@@ -1,7 +1,7 @@
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 #
 # Copyright (C) 2009-2015  Université de Bordeaux
-# Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique
+# Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015  Centre National de la Recherche Scientifique
 # Copyright (C) 2014 Inria
 #
 # StarPU is free software; you can redistribute it and/or modify
@@ -154,6 +154,8 @@ Small features:
     available on a given node.
   * New environment variable STARPU_RAND_SEED to set the seed used for random
     numbers.
+  * New function starpu_mpi_cache_set() to enable or disable the
+    communication cache at runtime
 
 Changes:
   * Fix complexity of implicit task/data dependency, from quadratic to linear.

+ 5 - 2
doc/doxygen/chapters/api/mpi.doxy

@@ -191,13 +191,16 @@ todo
 @name Communication Cache
 \ingroup API_MPI_Support
 
-\fn void starpu_mpi_cache_is_enabled()
+\fn int starpu_mpi_cache_is_enabled()
 \ingroup API_MPI_Support
 Return 1 if the communication cache is enabled, 0 otherwise
 
-\fn void starpu_mpi_cache_flush(MPI_Comm comm, starpu_data_handle_t data_handle)
+\fn int starpu_mpi_cache_set(int enabled)
 \ingroup API_MPI_Support
+If \p enabled is 1, enable the communication cache. Otherwise, clean the cache if it was enabled and disable it.
 
+\fn void starpu_mpi_cache_flush(MPI_Comm comm, starpu_data_handle_t data_handle)
+\ingroup API_MPI_Support
 Clear the send and receive communication cache for the data
 \p data_handle and invalidate the value. The function has to be called synchronously by all the
 MPI nodes. The function does nothing if the cache mechanism is

+ 1 - 0
mpi/include/starpu_mpi.h

@@ -86,6 +86,7 @@ char *starpu_mpi_node_selection_get_default_policy();
 int starpu_mpi_node_selection_set_default_policy(char *policy);
 
 int starpu_mpi_cache_is_enabled();
+int starpu_mpi_cache_set(int enabled);
 
 #ifdef __cplusplus
 }

+ 18 - 0
mpi/src/starpu_mpi_cache.c

@@ -41,6 +41,24 @@ int starpu_mpi_cache_is_enabled()
 	return _starpu_cache_enabled==1;
 }
 
+int starpu_mpi_cache_set(int enabled)
+{
+	if (enabled == 1)
+	{
+		_starpu_cache_enabled = 1;
+	}
+	else
+	{
+		if (_starpu_cache_enabled)
+		{
+			// We need to clean the cache
+			starpu_mpi_cache_flush_all_data(MPI_COMM_WORLD);
+		}
+		_starpu_cache_enabled = 0;
+	}
+	return 0;
+}
+
 void _starpu_mpi_cache_init(MPI_Comm comm)
 {
 	int nb_nodes;