Parcourir la source

Add starpu_memory_node_get_name, make starpu_perfmodel_recdump dump memory node information

Samuel Thibault il y a 6 ans
Parent
commit
2a179aa951

+ 1 - 0
include/starpu_data.h

@@ -135,6 +135,7 @@ enum starpu_node_kind
 
 unsigned starpu_worker_get_memory_node(unsigned workerid);
 unsigned starpu_memory_nodes_get_count(void);
+int starpu_memory_node_get_name(unsigned node, char *name, size_t size);
 int starpu_memory_nodes_get_numa_count(void);
 int starpu_memory_nodes_numa_id_to_devid(int osid);
 int starpu_memory_nodes_numa_devid_to_id(unsigned id);

+ 3 - 3
src/datawizard/copy_driver.c

@@ -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,2016,2017                      Inria
  * Copyright (C) 2010,2011,2013,2015-2018                 CNRS
  *
@@ -706,8 +706,8 @@ void starpu_interface_end_driver_copy_async(unsigned src_node, unsigned dst_node
 		{
 			char src_name[16], dst_name[16];
 			warned = 1;
-			_starpu_memory_node_get_name(src_node, src_name, sizeof(src_name));
-			_starpu_memory_node_get_name(dst_node, dst_name, sizeof(dst_name));
+			starpu_memory_node_get_name(src_node, src_name, sizeof(src_name));
+			starpu_memory_node_get_name(dst_node, dst_name, sizeof(dst_name));
 
 			_STARPU_DISP("Warning: the submission of asynchronous transfer from %s to %s took a very long time (%f ms)\nFor proper asynchronous transfer overlapping, data registered to StarPU must be allocated with starpu_malloc() or pinned with starpu_memory_pin()\n", src_name, dst_name, elapsed / 1000.);
 		}

+ 2 - 2
src/datawizard/datastats.c

@@ -70,7 +70,7 @@ void _starpu_display_msi_stats(FILE *stream)
 		if (hit_cnt[node]+miss_cnt[node])
 		{
 			char name[128];
-			_starpu_memory_node_get_name(node, name, sizeof(name));
+			starpu_memory_node_get_name(node, name, sizeof(name));
 			fprintf(stream, "memory node %s\n", name);
 			fprintf(stream, "\thit : %u (%2.2f %%)\n", hit_cnt[node], (100.0f*hit_cnt[node])/(hit_cnt[node]+miss_cnt[node]));
 			fprintf(stream, "\tmiss : %u (%2.2f %%)\n", miss_cnt[node], (100.0f*miss_cnt[node])/(hit_cnt[node]+miss_cnt[node]));
@@ -108,7 +108,7 @@ void _starpu_display_alloc_cache_stats(FILE *stream)
 		if (alloc_cnt[node])
 		{
 			char name[128];
-			_starpu_memory_node_get_name(node, name, sizeof(name));
+			starpu_memory_node_get_name(node, name, sizeof(name));
 			fprintf(stream, "memory node %s\n", name);
 			fprintf(stream, "\ttotal alloc : %u\n", alloc_cnt[node]);
 			fprintf(stream, "\tcached alloc: %u (%2.2f %%)\n",

+ 2 - 2
src/datawizard/memalloc.c

@@ -994,7 +994,7 @@ size_t _starpu_memory_reclaim_generic(unsigned node, unsigned force, size_t recl
 			if (STARPU_ATOMIC_ADD(&warned, 1) == 1)
 			{
 				char name[32];
-				_starpu_memory_node_get_name(node, name, sizeof(name));
+				starpu_memory_node_get_name(node, name, sizeof(name));
 				_STARPU_DISP("Not enough memory left on node %s. Your application data set seems too huge to fit on the device, StarPU will cope by trying to purge %lu MiB out. This message will not be printed again for further purges\n", name, (unsigned long) (reclaim / 1048576));
 			}
 		}
@@ -1215,7 +1215,7 @@ void starpu_memchunk_tidy(unsigned node)
 		if (STARPU_ATOMIC_ADD(&warned, 1) == 1)
 		{
 			char name[32];
-			_starpu_memory_node_get_name(node, name, sizeof(name));
+			starpu_memory_node_get_name(node, name, sizeof(name));
 			_STARPU_DISP("Low memory left on node %s (%ldMiB over %luMiB). Your application data set seems too huge to fit on the device, StarPU will cope by trying to purge %lu MiB out. This message will not be printed again for further purges. The thresholds can be tuned using the STARPU_MINIMUM_AVAILABLE_MEM and STARPU_TARGET_AVAILABLE_MEM environment variables.\n", name, (long) (available / 1048576), (unsigned long) (total / 1048576), (unsigned long) (amount / 1048576));
 		}
 	}

+ 3 - 3
src/datawizard/memory_nodes.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2017                                Université de Bordeaux
+ * Copyright (C) 2009-2017,2019                           Université de Bordeaux
  * Copyright (C) 2011-2013,2016,2017                      Inria
  * Copyright (C) 2010-2015,2017,2018                      CNRS
  *
@@ -72,7 +72,7 @@ unsigned starpu_memory_nodes_get_count(void)
 	return _starpu_memory_nodes_get_count();
 }
 
-void _starpu_memory_node_get_name(unsigned node, char *name, int size)
+int starpu_memory_node_get_name(unsigned node, char *name, size_t size)
 {
 	const char *prefix;
 	switch (_starpu_descr.nodes[node])
@@ -106,7 +106,7 @@ void _starpu_memory_node_get_name(unsigned node, char *name, int size)
 		prefix = "unknown";
 		STARPU_ASSERT(0);
 	}
-	snprintf(name, size, "%s %d", prefix, _starpu_descr.devid[node]);
+	return snprintf(name, size, "%s %d", prefix, _starpu_descr.devid[node]);
 }
 
 unsigned _starpu_memory_node_register(enum starpu_node_kind kind, int devid)

+ 1 - 3
src/datawizard/memory_nodes.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2012,2014-2017                      Université de Bordeaux
+ * Copyright (C) 2009-2012,2014-2017,2019                 Université de Bordeaux
  * Copyright (C) 2012,2016,2017                           Inria
  * Copyright (C) 2010,2011,2013,2015,2017                 CNRS
  *
@@ -117,8 +117,6 @@ static inline int _starpu_memory_node_get_devid(unsigned node)
 	return _starpu_descr.devid[node];
 }
 
-void _starpu_memory_node_get_name(unsigned node, char *name, int size);
-
 static inline struct _starpu_memory_node_descr *_starpu_memory_node_get_description(void)
 {
 	return &_starpu_descr;

+ 3 - 3
src/profiling/profiling_helpers.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2016,2017                                Inria
  * Copyright (C) 2010-2013,2016,2017                      CNRS
- * Copyright (C) 2010,2011,2013-2016                      Université de Bordeaux
+ * Copyright (C) 2010,2011,2013-2016, 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
@@ -53,8 +53,8 @@ void _starpu_profiling_bus_helper_display_summary(FILE *stream)
 
 		double d = convert_to_GB(transferred);
 
-		_starpu_memory_node_get_name(src, src_name, sizeof(src_name));
-		_starpu_memory_node_get_name(dst, dst_name, sizeof(dst_name));
+		starpu_memory_node_get_name(src, src_name, sizeof(src_name));
+		starpu_memory_node_get_name(dst, dst_name, sizeof(dst_name));
 
 		fprintf(stream, "\t%s -> %s", src_name, dst_name);
 		fprintf(stream, "\t%.4lf %s", d, "GB");

+ 26 - 1
tools/starpu_perfmodel_recdump.c

@@ -84,7 +84,7 @@ void get_comb_name(int comb, char* name, int name_size)
 void print_archs(FILE* output)
 {
 	int nb_workers = 0;
-	unsigned workerid; int comb, old_comb = -1;
+	unsigned workerid, node; int comb, old_comb = -1;
 
 	fprintf(output, "%%rec: worker_count\n\n");
 	for (workerid = 0; workerid < starpu_worker_get_count(); workerid++)
@@ -117,6 +117,31 @@ void print_archs(FILE* output)
 		fprintf(output, "Architecture: %s\n", name);
 		fprintf(output, "NbWorkers: %d\n\n", nb_workers);
 	}
+
+	fprintf(output, "%%rec: memory_workers\n\n");
+	for (node = 0; node < starpu_memory_nodes_get_count(); node++)
+	{
+		unsigned printed = 0;
+		char name[32];
+		fprintf(output, "MemoryNode: %d\n", node);
+		starpu_memory_node_get_name(node, name, sizeof(name));
+		fprintf(output, "Name: %s\n", name);
+		fprintf(output, "Size: %ld\n", (long) starpu_memory_get_total(node));
+		for (workerid = 0; workerid < starpu_worker_get_count(); workerid++)
+		{
+			if (starpu_worker_get_memory_node(workerid) == node)
+			{
+				if (!printed) {
+					fprintf(output, "Workers:");
+					printed = 1;
+				}
+				fprintf(output, " %d", workerid);
+			}
+		}
+		if (printed)
+			fprintf(output, "\n");
+		fprintf(output, "\n");
+	}
 }
 
 /* output file name */