Browse Source

environment variable STARPU_MEMORY_STATS is only checked at the end of the execution

Nathalie Furmento 12 years ago
parent
commit
e8c3444b92
3 changed files with 15 additions and 12 deletions
  1. 2 2
      doc/chapters/perf-feedback.texi
  2. 8 1
      src/core/workers.c
  3. 5 9
      src/datawizard/memalloc.c

+ 2 - 2
doc/chapters/perf-feedback.texi

@@ -444,14 +444,14 @@ It is possible to enable memory statistics. To do so, you need to pass the optio
 possible to call the function @code{starpu_display_memory_stats()} to
 possible to call the function @code{starpu_display_memory_stats()} to
 display statistics about the current data handles registered within StarPU.
 display statistics about the current data handles registered within StarPU.
 
 
-Moreover, when setting the environment variable @code{STARPU_MEMORY_STATUS}, statistics will be displayed at the end
+Moreover, when setting the environment variable @code{STARPU_MEMORY_STATS}, statistics will be displayed at the end
 of the execution on data handles which have not been cleared out.
 of the execution on data handles which have not been cleared out.
 
 
 For example, if you do not unregister data at the end of the complex
 For example, if you do not unregister data at the end of the complex
 example, you will get something similar to:
 example, you will get something similar to:
 
 
 @example
 @example
-$ STARPU_MEMORY_STATUS=1 ./examples/interface/complex
+$ STARPU_MEMORY_STATS=1 ./examples/interface/complex
 ...
 ...
 Memory status :
 Memory status :
 #-------
 #-------

+ 8 - 1
src/core/workers.c

@@ -884,7 +884,14 @@ void starpu_shutdown(void)
 	_starpu_display_alloc_cache_stats();
 	_starpu_display_alloc_cache_stats();
 	_starpu_display_comm_amounts();
 	_starpu_display_comm_amounts();
 
 
-	starpu_display_memory_stats();
+	{
+	     // Display statistics on data which have not been unregistered
+	     const char *stats;
+	     if ((stats = getenv("STARPU_MEMORY_STATS")) && atoi(stats))
+	     {
+		  starpu_display_memory_stats();
+	     }
+	}
 
 
 	starpu_bus_profiling_helper_display_summary();
 	starpu_bus_profiling_helper_display_summary();
 	starpu_worker_profiling_helper_display_summary();
 	starpu_worker_profiling_helper_display_summary();

+ 5 - 9
src/datawizard/memalloc.c

@@ -960,18 +960,14 @@ void starpu_display_memory_stats(void)
 {
 {
 #ifdef STARPU_MEMORY_STATS
 #ifdef STARPU_MEMORY_STATS
 	unsigned node;
 	unsigned node;
-	const char *stats;
 
 
-	if ((stats = getenv("STARPU_MEMORY_STATS")) && atoi(stats))
+	fprintf(stderr, "\n#---------------------\n");
+	fprintf(stderr, "Memory stats :\n");
+	for (node = 0; node < STARPU_MAXNODES; node++)
 	{
 	{
-		fprintf(stderr, "\n#---------------------\n");
-		fprintf(stderr, "Memory stats :\n");
-		for (node = 0; node < STARPU_MAXNODES; node++)
-		{
-			_starpu_display_memory_stats_by_node(node);
-		}
-		fprintf(stderr, "\n#---------------------\n");
+	     _starpu_display_memory_stats_by_node(node);
 	}
 	}
+	fprintf(stderr, "\n#---------------------\n");
 #endif
 #endif
 }
 }