瀏覽代碼

Add poti support for paje trace output, thanks Lucas Schnorr for the initial patch

Samuel Thibault 12 年之前
父節點
當前提交
e6c6ed9b7a
共有 4 個文件被更改,包括 424 次插入218 次删除
  1. 9 0
      configure.ac
  2. 288 96
      src/debug/traces/starpu_fxt.c
  3. 18 2
      src/debug/traces/starpu_fxt_mpi.c
  4. 109 120
      src/debug/traces/starpu_paje.c

+ 9 - 0
configure.ac

@@ -972,6 +972,15 @@ if test x$use_fxt = xyes; then
 	AC_CHECK_DECLS([enable_fut_flush])
 	AC_CHECK_DECLS([fut_set_filename])
 	CFLAGS="$save_CFLAGS"
+
+	##########################################
+	# Poti is a library to generate paje trace files
+	##########################################
+	PKG_CHECK_MODULES([POTI], [poti], [
+		AC_DEFINE(STARPU_HAVE_POTI, [1], [Define to 1 if you have libpoti])
+	], [:])
+	FXT_CFLAGS="$FXT_CFLAGS $POTI_CFLAGS"
+	FXT_LIBS="$FXT_LIBS $POTI_LIBS"
 fi
 
 AC_MSG_CHECKING(whether performance debugging should be enabled)

+ 288 - 96
src/debug/traces/starpu_fxt.c

@@ -18,6 +18,11 @@
 #include <common/config.h>
 #include <common/uthash.h>
 
+#ifdef STARPU_HAVE_POTI
+#include <poti.h>
+#define STARPU_POTI_STR_LEN 200
+#endif
+
 #ifdef STARPU_USE_FXT
 #include "starpu_fxt.h"
 #include <inttypes.h>
@@ -80,7 +85,7 @@ static unsigned get_colour_symbol_blue(char *name)
 	return (unsigned)starpu_crc32_string("blue", hash_symbol) % 1024;
 }
 
-static float last_codelet_start[STARPU_NMAXWORKERS];
+static double last_codelet_start[STARPU_NMAXWORKERS];
 static char last_codelet_symbol[128][STARPU_NMAXWORKERS];
 
 /* If more than a period of time has elapsed, we flush the profiling info,
@@ -98,8 +103,8 @@ static struct _starpu_symbol_name_list *symbol_list;
 
 LIST_TYPE(_starpu_communication,
 	unsigned comid;
-	float comm_start;
-	float bandwidth;
+	double comm_start;
+	double bandwidth;
 	unsigned src_node;
 	unsigned dst_node;
 )
@@ -118,9 +123,9 @@ static FILE *activity_file;
  * Generic tools
  */
 
-static float get_event_time_stamp(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
+static double get_event_time_stamp(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 {
-	return (float)((ev->time-options->file_offset)/1000000.0);
+	return (((double)(ev->time-options->file_offset))/1000000.0);
 }
 
 static int nworkers = 0;
@@ -173,7 +178,7 @@ static void update_accumulated_time(int worker, double sleep_time, double exec_t
 	if (forceflush || (elapsed > ACTIVITY_PERIOD))
 	{
 		if (activity_file)
-			fprintf(activity_file, "%d\t%f\t%f\t%f\t%f\n", worker, current_timestamp, elapsed, accumulated_exec_time[worker], accumulated_sleep_time[worker]);
+			fprintf(activity_file, "%d\t%.9f\t%.9f\t%.9f\t%.9f\n", worker, current_timestamp, elapsed, accumulated_exec_time[worker], accumulated_sleep_time[worker]);
 
 		/* reset the accumulated times */
 		last_activity_flush_timestamp[worker] = current_timestamp;
@@ -183,6 +188,58 @@ static void update_accumulated_time(int worker, double sleep_time, double exec_t
 }
 
 /*
+ *      Auxiliary functions for poti handling names
+ */
+#ifdef STARPU_HAVE_POTI
+static char *memnode_container_alias(char *output, int len, const char *prefix, long unsigned int memnodeid)
+{
+	snprintf(output, len, "mn%s%"PRIu64"", prefix, memnodeid);
+	return output;
+}
+
+static char *worker_container_alias(char *output, int len, const char *prefix, long unsigned int workerid)
+{
+	snprintf(output, len, "t%s%"PRIu64"", prefix, workerid);
+	return output;
+}
+
+static char *program_container_alias(char *output, int len, const char *prefix)
+{
+	snprintf(output, len, "%sp", prefix);
+	return output;
+}
+
+static char *scheduler_container_alias(char *output, int len, const char *prefix)
+{
+	snprintf(output, len, "%ssched", prefix);
+	return output;
+}
+#endif
+
+static void memnode_set_state(double time, const char *prefix, unsigned int memnodeid, const char *name)
+{
+#ifdef STARPU_HAVE_POTI
+	char container[STARPU_POTI_STR_LEN];
+	memnode_container_alias(container, STARPU_POTI_STR_LEN, prefix, memnodeid);
+	poti_SetState(time, container, "S", name);
+#else
+	fprintf(out_paje_file, "10	%.9f	%smn%u	MS	%s\n", time, prefix, memnodeid, name);
+#endif
+}
+
+static void worker_set_state(double time, const char *prefix, long unsigned int workerid, const char *name)
+{
+#ifdef STARPU_HAVE_POTI
+	char container[STARPU_POTI_STR_LEN];
+	worker_container_alias(container, STARPU_POTI_STR_LEN, prefix, workerid);
+	poti_SetState(time, container, "S", name);
+#else
+	fprintf(out_paje_file, "10	%.9f	t%s%"PRIu64"	S	%s\n", time, prefix, workerid, name);
+#endif
+}
+
+
+/*
  *	Initialization
  */
 
@@ -192,10 +249,23 @@ static void handle_new_mem_node(struct fxt_ev_64 *ev, struct starpu_fxt_options
 
 	if (out_paje_file)
 	{
-		fprintf(out_paje_file, "7       %f	%"PRIu64"      Mn      %sp	%sMEMNODE%"PRIu64"\n", get_event_time_stamp(ev, options), ev->param[0], prefix, options->file_prefix, ev->param[0]);
+#ifdef STARPU_HAVE_POTI
+		char program_container[STARPU_POTI_STR_LEN];
+		program_container_alias(program_container, STARPU_POTI_STR_LEN, prefix);
+		char new_memnode_container_alias[STARPU_POTI_STR_LEN], new_memnode_container_name[STARPU_POTI_STR_LEN];
+		memnode_container_alias (new_memnode_container_alias, STARPU_POTI_STR_LEN, prefix, ev->param[0]);
+		snprintf(new_memnode_container_name, STARPU_POTI_STR_LEN, "%sMEMNODE%"PRIu64"", prefix, ev->param[0]);
+		poti_CreateContainer(get_event_time_stamp(ev, options), new_memnode_container_alias, "Mn", program_container, new_memnode_container_name);
+#else
+		fprintf(out_paje_file, "7	%.9f	mn%"PRIu64"	Mn	%sp	%sMEMNODE%"PRIu64"\n", get_event_time_stamp(ev, options), ev->param[0], prefix, options->file_prefix, ev->param[0]);
+#endif
 
 		if (!options->no_bus)
-			fprintf(out_paje_file, "13       %f bw %sMEMNODE%"PRIu64" 0.0\n", 0.0f, prefix, ev->param[0]);
+#ifdef STARPU_HAVE_POTI
+			poti_SetVariable(get_event_time_stamp(ev, options), new_memnode_container_alias, "bw", 0.0);
+#else
+			fprintf(out_paje_file, "13	%.9f	%sMEMNODE%"PRIu64"	bw	0.0\n", 0.0f, prefix, ev->param[0]);
+#endif
 	}
 }
 
@@ -209,8 +279,20 @@ static void handle_worker_init_start(struct fxt_ev_64 *ev, struct starpu_fxt_opt
 	char *prefix = options->file_prefix;
 
 	if (out_paje_file)
-	fprintf(out_paje_file, "7       %f	%s%"PRIu64"      T      %sMEMNODE%"PRIu64"       %s%"PRIu64"\n",
-		get_event_time_stamp(ev, options), prefix, ev->param[3], prefix, ev->param[2], prefix, ev->param[3]);
+	{
+#ifdef STARPU_HAVE_POTI
+		char new_worker_container_alias[STARPU_POTI_STR_LEN];
+		worker_container_alias (new_worker_container_alias, STARPU_POTI_STR_LEN, prefix, ev->param[3]);
+		char memnode_container[STARPU_POTI_STR_LEN];
+		memnode_container_alias(memnode_container, STARPU_POTI_STR_LEN, prefix, ev->param[2]);
+		char new_worker_container_name[STARPU_POTI_STR_LEN];
+		snprintf(new_worker_container_name, STARPU_POTI_STR_LEN, "%s%"PRIu64"", prefix, ev->param[3]);
+		poti_CreateContainer(get_event_time_stamp(ev, options), new_worker_container_alias, "T", memnode_container, new_worker_container_name);
+#else
+		fprintf(out_paje_file, "7	%.9f	t%s%"PRIu64"	T	%smn%"PRIu64"	%s%"PRIu64"\n",
+			get_event_time_stamp(ev, options), prefix, ev->param[3], prefix, ev->param[2], prefix, ev->param[3]);
+#endif
+	}
 
 	int devid = ev->param[1];
 	int workerid = register_worker_id(ev->param[3]);
@@ -245,8 +327,7 @@ static void handle_worker_init_start(struct fxt_ev_64 *ev, struct starpu_fxt_opt
 
 	/* start initialization */
 	if (out_paje_file)
-	fprintf(out_paje_file, "10       %f     S      %s%"PRIu64"      I\n",
-			get_event_time_stamp(ev, options), prefix, ev->param[3]);
+		worker_set_state(get_event_time_stamp(ev, options), prefix, ev->param[3], "I");
 
 	if (activity_file)
 	fprintf(activity_file, "name\t%d\t%s %d\n", workerid, kindstr, devid);
@@ -260,8 +341,7 @@ static void handle_worker_init_end(struct fxt_ev_64 *ev, struct starpu_fxt_optio
 	char *prefix = options->file_prefix;
 
 	if (out_paje_file)
-	fprintf(out_paje_file, "10       %f     S      %s%"PRIu64"      B\n",
-			get_event_time_stamp(ev, options), prefix, ev->param[0]);
+		worker_set_state(get_event_time_stamp(ev, options), prefix, ev->param[0], "B");
 
 	/* Initilize the accumulated time counters */
 	int worker = find_worker_id(ev->param[0]);
@@ -275,8 +355,7 @@ static void handle_worker_deinit_start(struct fxt_ev_64 *ev, struct starpu_fxt_o
 	char *prefix = options->file_prefix;
 
 	if (out_paje_file)
-	fprintf(out_paje_file, "10       %f     S      %s%"PRIu64"      D\n",
-			get_event_time_stamp(ev, options), prefix, ev->param[0]);
+		worker_set_state(get_event_time_stamp(ev, options), prefix, ev->param[0], "D");
 }
 
 static void handle_worker_deinit_end(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -284,9 +363,26 @@ static void handle_worker_deinit_end(struct fxt_ev_64 *ev, struct starpu_fxt_opt
 	char *prefix = options->file_prefix;
 
 	if (out_paje_file)
-	fprintf(out_paje_file, "8       %f	%s%"PRIu64"	T\n",
+	{
+#ifdef STARPU_HAVE_POTI
+		char worker_container[STARPU_POTI_STR_LEN];
+		worker_container_alias(worker_container, STARPU_POTI_STR_LEN, prefix, ev->param[1]);
+		poti_DestroyContainer(get_event_time_stamp(ev, options), "T", worker_container);
+#else
+		fprintf(out_paje_file, "8	%.9f	t%s%"PRIu64"	T\n",
 			get_event_time_stamp(ev, options), prefix, ev->param[1]);
+#endif
+	}
+}
+
+#ifdef STARPU_HAVE_POTI
+static void create_paje_state_color(char *name, char *type, float red, float green, float blue)
+{
+	char color[STARPU_POTI_STR_LEN];
+	snprintf(color, STARPU_POTI_STR_LEN, "%f %f %f", red, green, blue);
+	poti_DefineEntityValue(name, type, name, color);
 }
+#endif
 
 static void create_paje_state_if_not_found(char *name, struct starpu_fxt_options *options)
 {
@@ -334,18 +430,31 @@ static void create_paje_state_if_not_found(char *name, struct starpu_fxt_options
 	/* create the Paje state */
 	if (out_paje_file)
 	{
-		fprintf(out_paje_file, "6       %s       S       %s \"%f %f %f\" \n", name, name, red, green, blue);
-		fprintf(out_paje_file, "6       %s       Ctx1       %s \"255.0 255.0 0.0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx2       %s \".0 255.0 .0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx3       %s \"75.0 .0 130.0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx4       %s \".0 245.0 255.0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx5       %s \".0 .0 .0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx6       %s \".0 .0 128.0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx7       %s \"105.0 105.0 105.0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx8       %s \"255.0 .0 255.0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx9       %s \".0 .0 1.0\" \n", name, name);
-		fprintf(out_paje_file, "6       %s       Ctx10       %s \"154.0 205.0 50.0\" \n", name, name);
-
+#ifdef STARPU_HAVE_POTI
+		create_paje_state_color(name, "S", red, green, blue);
+		create_paje_state_color(name, "Ctx1", 255.0, 255.0, 0.0);
+		create_paje_state_color(name, "Ctx2", .0, 255.0, 0.0);
+		create_paje_state_color(name, "Ctx3", 75.0, .0, 130.0);
+		create_paje_state_color(name, "Ctx4", .0, 245.0, 255.0);
+		create_paje_state_color(name, "Ctx5", .0, .0, .0);
+		create_paje_state_color(name, "Ctx6", .0, .0, 128.0);
+		create_paje_state_color(name, "Ctx7", 105.0, 105.0, 105.0);
+		create_paje_state_color(name, "Ctx8", 255.0, .0, 255.0);
+		create_paje_state_color(name, "Ctx9", .0, .0, 1.0);
+		create_paje_state_color(name, "Ctx10", 154.0, 205.0, 50.0);
+#else
+		fprintf(out_paje_file, "6	%s	S	%s	\"%f %f %f\" \n", name, name, red, green, blue);
+		fprintf(out_paje_file, "6	%s	Ctx1	%s	\"255.0 255.0 0.0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx2	%s	\".0 255.0 .0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx3	%s	\"75.0 .0 130.0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx4	%s	\".0 245.0 255.0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx5	%s	\".0 .0 .0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx6	%s	\".0 .0 128.0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx7	%s	\"105.0 105.0 105.0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx8	%s	\"255.0 .0 255.0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx9	%s	\".0 .0 1.0\" \n", name, name);
+		fprintf(out_paje_file, "6	%s	Ctx10	%s	\"154.0 205.0 50.0\" \n", name, name);
+#endif
 	}
 		
 }
@@ -366,36 +475,26 @@ static void handle_start_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_op
 
 	snprintf(last_codelet_symbol[worker], 128, "%s", name);
 
-	float start_codelet_time = get_event_time_stamp(ev, options);
+	double start_codelet_time = get_event_time_stamp(ev, options);
 	last_codelet_start[worker] = start_codelet_time;
 
 	create_paje_state_if_not_found(name, options);
 
 	if (out_paje_file)
 	{
-	  	  fprintf(out_paje_file, "10       %f	S      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-
-		if(sched_ctx == 1)
-		  fprintf(out_paje_file, "10       %f	Ctx1      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 2)
-		  fprintf(out_paje_file, "10       %f	Ctx2      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 3)
-		  fprintf(out_paje_file, "10       %f	Ctx3      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 4)
-		  fprintf(out_paje_file, "10       %f	Ctx4      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 5)
-		  fprintf(out_paje_file, "10       %f	Ctx5      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 6)
-		  fprintf(out_paje_file, "10       %f	Ctx6      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 7)
-		  fprintf(out_paje_file, "10       %f	Ctx7      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 8)
-		  fprintf(out_paje_file, "10       %f	Ctx8      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 9)
-		  fprintf(out_paje_file, "10       %f	Ctx9      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-		else if(sched_ctx == 10)
-		  fprintf(out_paje_file, "10       %f	Ctx10      %s%"PRIu64"      %s\n", start_codelet_time, prefix, ev->param[2], name);
-
+		worker_set_state(start_codelet_time, prefix, ev->param[2], name);
+		if (sched_ctx != 0)
+		{
+#ifdef STARPU_HAVE_POTI
+			char container[STARPU_POTI_STR_LEN];
+			char ctx[6];
+			snprintf(ctx, sizeof(ctx), "Ctx%d", sched_ctx);
+			worker_container_alias(container, STARPU_POTI_STR_LEN, prefix, ev->param[2]);
+			poti_SetState(start_codelet_time, container, ctx, name);
+#else
+			fprintf(out_paje_file, "10	%.9f	t%s%"PRIu64"	Ctx%d	%s\n", start_codelet_time, prefix, ev->param[2], sched_ctx, name);
+#endif
+		}
 	}
 	
 }
@@ -411,20 +510,20 @@ static void handle_end_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_opti
 
 	char *prefix = options->file_prefix;
 
-	float end_codelet_time = get_event_time_stamp(ev, options);
+	double end_codelet_time = get_event_time_stamp(ev, options);
 
 	size_t codelet_size = ev->param[1];
 	uint32_t codelet_hash = ev->param[2];
 
 	if (out_paje_file)
-	fprintf(out_paje_file, "10       %f	S      %s%"PRIu64"      B\n", end_codelet_time, prefix, ev->param[4]);
+		worker_set_state(end_codelet_time, prefix, ev->param[4], "B");
 
-	float codelet_length = (end_codelet_time - last_codelet_start[worker]);
+	double codelet_length = (end_codelet_time - last_codelet_start[worker]);
 
 	update_accumulated_time(worker, 0.0, codelet_length, end_codelet_time, 0);
 
 	if (distrib_time)
-	fprintf(distrib_time, "%s\t%s%d\t%ld\t%"PRIx32"\t%f\n", last_codelet_symbol[worker],
+	fprintf(distrib_time, "%s\t%s%d\t%ld\t%"PRIx32"\t%.9f\n", last_codelet_symbol[worker],
 				prefix, worker, codelet_size, codelet_hash, codelet_length);
 
 	if (options->dumped_codelets)
@@ -448,6 +547,10 @@ static void handle_user_event(struct fxt_ev_64 *ev, struct starpu_fxt_options *o
 {
 	int worker;
 	unsigned long code = ev->param[0];
+#ifdef STARPU_HAVE_POTI
+	char paje_value[STARPU_POTI_STR_LEN], container[STARPU_POTI_STR_LEN];
+	snprintf(paje_value, STARPU_POTI_STR_LEN, "%lu", code);
+#endif
 
 	char *prefix = options->file_prefix;
 
@@ -455,13 +558,25 @@ static void handle_user_event(struct fxt_ev_64 *ev, struct starpu_fxt_options *o
 	if (worker < 0)
 	{
 		if (out_paje_file)
-			fprintf(out_paje_file, "9       %f     event      %sp      %lu\n", get_event_time_stamp(ev, options), prefix, code);
+#ifdef STARPU_HAVE_POTI
+			program_container_alias (container, STARPU_POTI_STR_LEN, prefix);
+#else
+			fprintf(out_paje_file, "9	%.9f	event	%sp	%lu\n", get_event_time_stamp(ev, options), prefix, code);
+#endif
 	}
 	else
 	{
 		if (out_paje_file)
-			fprintf(out_paje_file, "9       %f     event      %s%"PRIu64"      %lu\n", get_event_time_stamp(ev, options), prefix, ev->param[1], code);
+#ifdef STARPU_HAVE_POTI
+			worker_container_alias (container, STARPU_POTI_STR_LEN, prefix, ev->param[1]);
+#else
+			fprintf(out_paje_file, "9	%.9f	event	t%s%"PRIu64"	%lu\n", get_event_time_stamp(ev, options), prefix, ev->param[1], code);
+#endif
 	}
+#ifdef STARPU_HAVE_POTI
+	if (out_paje_file)
+		poti_NewEvent(get_event_time_stamp(ev, options), container, "event", paje_value);
+#endif
 }
 
 static void handle_start_callback(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -472,7 +587,7 @@ static void handle_start_callback(struct fxt_ev_64 *ev, struct starpu_fxt_option
 		return;
 
 	if (out_paje_file)
-		fprintf(out_paje_file, "10       %f	S      %s%"PRIu64"      C\n", get_event_time_stamp(ev, options), options->file_prefix, ev->param[1] );
+		worker_set_state(get_event_time_stamp(ev, options), options->file_prefix, ev->param[1], "C");
 }
 
 static void handle_end_callback(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -483,7 +598,7 @@ static void handle_end_callback(struct fxt_ev_64 *ev, struct starpu_fxt_options
 		return;
 
 	if (out_paje_file)
-		fprintf(out_paje_file, "10       %f	S      %s%"PRIu64"      B\n", get_event_time_stamp(ev, options), options->file_prefix, ev->param[1] );
+		worker_set_state(get_event_time_stamp(ev, options), options->file_prefix, ev->param[1], "B");
 }
 
 static void handle_worker_status(struct fxt_ev_64 *ev, struct starpu_fxt_options *options, const char *newstatus)
@@ -494,8 +609,7 @@ static void handle_worker_status(struct fxt_ev_64 *ev, struct starpu_fxt_options
 		return;
 
 	if (out_paje_file)
-		fprintf(out_paje_file, "10       %f	S      %s%"PRIu64"      %s\n",
-			get_event_time_stamp(ev, options), options->file_prefix, ev->param[1], newstatus);
+		worker_set_state(get_event_time_stamp(ev, options), options->file_prefix, ev->param[1], newstatus);
 }
 
 static double last_sleep_start[STARPU_NMAXWORKERS];
@@ -506,12 +620,11 @@ static void handle_start_sleep(struct fxt_ev_64 *ev, struct starpu_fxt_options *
 	worker = find_worker_id(ev->param[0]);
 	if (worker < 0) return;
 
-	float start_sleep_time = get_event_time_stamp(ev, options);
+	double start_sleep_time = get_event_time_stamp(ev, options);
 	last_sleep_start[worker] = start_sleep_time;
 
 	if (out_paje_file)
-		fprintf(out_paje_file, "10       %f	S      %s%"PRIu64"      Sl\n",
-			get_event_time_stamp(ev, options), options->file_prefix, ev->param[0]);
+		worker_set_state(get_event_time_stamp(ev, options), options->file_prefix, ev->param[0], "Sl");
 }
 
 static void handle_end_sleep(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -520,11 +633,10 @@ static void handle_end_sleep(struct fxt_ev_64 *ev, struct starpu_fxt_options *op
 	worker = find_worker_id(ev->param[0]);
 	if (worker < 0) return;
 
-	float end_sleep_timestamp = get_event_time_stamp(ev, options);
+	double end_sleep_timestamp = get_event_time_stamp(ev, options);
 
 	if (out_paje_file)
-		fprintf(out_paje_file, "10       %f	S      %s%"PRIu64"      B\n",
-			end_sleep_timestamp, options->file_prefix, ev->param[0]);
+		worker_set_state(end_sleep_timestamp, options->file_prefix, ev->param[0], "B");
 
 	double sleep_length = end_sleep_timestamp - last_sleep_start[worker];
 
@@ -548,8 +660,19 @@ static void handle_start_driver_copy(struct fxt_ev_64 *ev, struct starpu_fxt_opt
 	{
 		if (out_paje_file)
 		{
-			fprintf(out_paje_file, "10       %f     MS      %sMEMNODE%u      Co\n", get_event_time_stamp(ev, options), prefix, dst);
-			fprintf(out_paje_file, "18       %f	L      %sp	%u	%sMEMNODE%u	com_%u\n", get_event_time_stamp(ev, options), prefix, size, prefix, src, comid);
+			double time = get_event_time_stamp(ev, options);
+			memnode_set_state(time, prefix, dst, "Co");
+#ifdef STARPU_HAVE_POTI
+			char paje_value[STARPU_POTI_STR_LEN], paje_key[STARPU_POTI_STR_LEN], src_memnode_container[STARPU_POTI_STR_LEN];
+			char program_container[STARPU_POTI_STR_LEN];
+			snprintf(paje_value, STARPU_POTI_STR_LEN, "%u", size);
+			snprintf(paje_key, STARPU_POTI_STR_LEN, "com_%u", comid);
+			program_container_alias(program_container, STARPU_POTI_STR_LEN, prefix);
+			memnode_container_alias(src_memnode_container, STARPU_POTI_STR_LEN, prefix, src);
+			poti_StartLink(time, program_container, "L", src_memnode_container, paje_value, paje_key);
+#else
+			fprintf(out_paje_file, "18	%.9f	L	%sp	%u	%smn%u	com_%u\n", time, prefix, size, prefix, src, comid);
+#endif
 		}
 
 		/* create a structure to store the start of the communication, this will be matched later */
@@ -577,8 +700,18 @@ static void handle_end_driver_copy(struct fxt_ev_64 *ev, struct starpu_fxt_optio
 	{
 		if (out_paje_file)
 		{
-			fprintf(out_paje_file, "10       %f     MS      %sMEMNODE%u      No\n", get_event_time_stamp(ev, options), prefix, dst);
-			fprintf(out_paje_file, "19       %f	L      %sp	%u	%sMEMNODE%u	com_%u\n", get_event_time_stamp(ev, options), prefix, size, prefix, dst, comid);
+			double time = get_event_time_stamp(ev, options);
+			memnode_set_state(time, prefix, dst, "No");
+#ifdef STARPU_HAVE_POTI
+			char paje_value[STARPU_POTI_STR_LEN], paje_key[STARPU_POTI_STR_LEN];
+			char dst_memnode_container[STARPU_POTI_STR_LEN], program_container[STARPU_POTI_STR_LEN];
+			program_container_alias(program_container, STARPU_POTI_STR_LEN, prefix);
+			snprintf(paje_value, STARPU_POTI_STR_LEN, "%u", size);
+			snprintf(paje_key, STARPU_POTI_STR_LEN, "com_%u", comid);
+			poti_EndLink(time, program_container, "L", dst_memnode_container, paje_value, paje_key);
+#else
+			fprintf(out_paje_file, "19	%.9f	L	%sp	%u	%smn%u	com_%u\n", time, prefix, size, prefix, dst, comid);
+#endif
 		}
 
 		/* look for a data transfer to match */
@@ -589,8 +722,8 @@ static void handle_end_driver_copy(struct fxt_ev_64 *ev, struct starpu_fxt_optio
 		{
 			if (itor->comid == comid)
 			{
-				float comm_end = get_event_time_stamp(ev, options);
-				float bandwidth = (float)((0.001*size)/(comm_end - itor->comm_start));
+				double comm_end = get_event_time_stamp(ev, options);
+				double bandwidth = (double)((0.001*size)/(comm_end - itor->comm_start));
 
 				itor->bandwidth = bandwidth;
 
@@ -618,7 +751,7 @@ static void handle_start_driver_copy_async(struct fxt_ev_64 *ev, struct starpu_f
 
 	if (!options->no_bus)
 		if (out_paje_file)
-			fprintf(out_paje_file, "10       %f     MS      %sMEMNODE%u      CoA\n", get_event_time_stamp(ev, options), prefix, dst);
+			memnode_set_state(get_event_time_stamp(ev, options), prefix, dst, "CoA");
 
 }
 
@@ -630,7 +763,7 @@ static void handle_end_driver_copy_async(struct fxt_ev_64 *ev, struct starpu_fxt
 
 	if (!options->no_bus)
 		if (out_paje_file)
-			fprintf(out_paje_file, "10       %f     MS      %sMEMNODE%u      Co\n", get_event_time_stamp(ev, options), prefix, dst);
+			memnode_set_state(get_event_time_stamp(ev, options), prefix, dst, "Co");
 }
 
 static void handle_memnode_event(struct fxt_ev_64 *ev, struct starpu_fxt_options *options, const char *eventstr)
@@ -638,8 +771,7 @@ static void handle_memnode_event(struct fxt_ev_64 *ev, struct starpu_fxt_options
 	unsigned memnode = ev->param[0];
 
 	if (out_paje_file)
-	fprintf(out_paje_file, "10       %f     MS      %sMEMNODE%u      %s\n",
-		get_event_time_stamp(ev, options), options->file_prefix, memnode, eventstr);
+		memnode_set_state(get_event_time_stamp(ev, options), options->file_prefix, memnode, eventstr);
 }
 
 /*
@@ -649,37 +781,54 @@ static int curq_size = 0;
 
 static void handle_job_push(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 {
-	float current_timestamp = get_event_time_stamp(ev, options);
+	double current_timestamp = get_event_time_stamp(ev, options);
 
 	curq_size++;
 
 	if (!options->no_counter && out_paje_file)
-		fprintf(out_paje_file, "13       %f ntask %ssched %f\n", current_timestamp, options->file_prefix, (float)curq_size);
+	{
+#ifdef STARPU_HAVE_POTI
+		char container[STARPU_POTI_STR_LEN];
+
+		scheduler_container_alias(container, STARPU_POTI_STR_LEN, options->file_prefix);
+		poti_SetVariable(current_timestamp, container, "ntask", (double)curq_size);
+#else
+		fprintf(out_paje_file, "13	%.9f	%ssched	ntask	%f\n", current_timestamp, options->file_prefix, (float)curq_size);
+#endif
+	}
 
 	if (activity_file)
-	fprintf(activity_file, "cnt_ready\t%f\t%d\n", current_timestamp, curq_size);
+	fprintf(activity_file, "cnt_ready\t%.9f\t%d\n", current_timestamp, curq_size);
 }
 
 static void handle_job_pop(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 {
-	float current_timestamp = get_event_time_stamp(ev, options);
+	double current_timestamp = get_event_time_stamp(ev, options);
 
 	curq_size--;
 
 	if (!options->no_counter && out_paje_file)
-		fprintf(out_paje_file, "13       %f ntask %ssched %f\n", current_timestamp, options->file_prefix, (float)curq_size);
+	{
+#ifdef STARPU_HAVE_POTI
+		char container[STARPU_POTI_STR_LEN];
+		scheduler_container_alias(container, STARPU_POTI_STR_LEN, options->file_prefix);
+		poti_SetVariable(current_timestamp, container, "ntask", (double)curq_size);
+#else
+		fprintf(out_paje_file, "13	%.9f	%ssched	ntask	%f\n", current_timestamp, options->file_prefix, (float)curq_size);
+#endif
+	}
 
 	if (activity_file)
-		fprintf(activity_file, "cnt_ready\t%f\t%d\n", current_timestamp, curq_size);
+		fprintf(activity_file, "cnt_ready\t%.9f\t%d\n", current_timestamp, curq_size);
 }
 
 static
 void handle_update_task_cnt(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 {
-	float current_timestamp = get_event_time_stamp(ev, options);
+	double current_timestamp = get_event_time_stamp(ev, options);
 	unsigned long nsubmitted = ev->param[0];
 	if (activity_file)
-	fprintf(activity_file, "cnt_submitted\t%f\t%lu\n", current_timestamp, nsubmitted);
+	fprintf(activity_file, "cnt_submitted\t%.9f\t%lu\n", current_timestamp, nsubmitted);
 }
 
 static void handle_codelet_tag(struct fxt_ev_64 *ev)
@@ -782,7 +931,16 @@ static void handle_mpi_barrier(struct fxt_ev_64 *ev, struct starpu_fxt_options *
 
 	/* Add an event in the trace */
 	if (out_paje_file)
-	fprintf(out_paje_file, "9       %f     event      %sp      %d\n", get_event_time_stamp(ev, options), options->file_prefix, rank);
+	{
+#ifdef STARPU_HAVE_POTI
+		char container[STARPU_POTI_STR_LEN], paje_value[STARPU_POTI_STR_LEN];
+		snprintf(container, STARPU_POTI_STR_LEN, "%sp", options->file_prefix);
+		snprintf(container, STARPU_POTI_STR_LEN, "%d", rank);
+		poti_NewEvent(get_event_time_stamp(ev, options), container, "event", paje_value);
+#else
+		fprintf(out_paje_file, "9	%.9f	event	%sp	%d\n", get_event_time_stamp(ev, options), options->file_prefix, rank);
+#endif
+	}
 }
 
 static void handle_mpi_isend(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -790,7 +948,7 @@ static void handle_mpi_isend(struct fxt_ev_64 *ev, struct starpu_fxt_options *op
 	int dest = ev->param[0];
 	int mpi_tag = ev->param[1];
 	size_t size = ev->param[2];
-	float date = get_event_time_stamp(ev, options);
+	double date = get_event_time_stamp(ev, options);
 
 	_starpu_fxt_mpi_add_send_transfer(options->file_rank, dest, mpi_tag, size, date);
 }
@@ -799,7 +957,7 @@ static void handle_mpi_irecv_end(struct fxt_ev_64 *ev, struct starpu_fxt_options
 {
 	int src = ev->param[0];
 	int mpi_tag = ev->param[1];
-	float date = get_event_time_stamp(ev, options);
+	double date = get_event_time_stamp(ev, options);
 
 	_starpu_fxt_mpi_add_recv_transfer(src, options->file_rank, mpi_tag, date);
 }
@@ -809,7 +967,7 @@ static void handle_set_profiling(struct fxt_ev_64 *ev, struct starpu_fxt_options
 	int status = ev->param[0];
 
 	if (activity_file)
-	fprintf(activity_file, "set_profiling\t%f\t%d\n", get_event_time_stamp(ev, options), status);
+	fprintf(activity_file, "set_profiling\t%.9f\t%d\n", get_event_time_stamp(ev, options), status);
 }
 
 static void handle_task_wait_for_all(void)
@@ -831,13 +989,29 @@ void _starpu_fxt_display_bandwidth(struct starpu_fxt_options *options)
 	{
 		current_bandwidth_per_node[itor->src_node] +=  itor->bandwidth;
 		if (out_paje_file)
-		fprintf(out_paje_file, "13  %f bw %sMEMNODE%u %f\n",
+		{
+#ifdef STARPU_HAVE_POTI
+			char src_memnode_container[STARPU_POTI_STR_LEN];
+			memnode_container_alias(src_memnode_container, STARPU_POTI_STR_LEN, prefix, itor->src_node);
+			poti_SetVariable(itor->comm_start, src_memnode_container, "bw", current_bandwidth_per_node[itor->src_node]);
+#else
+			fprintf(out_paje_file, "13	%.9f	%smn%u	bw	%f\n",
 				itor->comm_start, prefix, itor->src_node, current_bandwidth_per_node[itor->src_node]);
+#endif
+		}
 
 		current_bandwidth_per_node[itor->dst_node] +=  itor->bandwidth;
 		if (out_paje_file)
-		fprintf(out_paje_file, "13  %f bw %sMEMNODE%u %f\n",
+		{
+#ifdef STARPU_HAVE_POTI
+			char dst_memnode_container[STARPU_POTI_STR_LEN];
+			memnode_container_alias(dst_memnode_container, STARPU_POTI_STR_LEN, prefix, itor->dst_node);
+			poti_SetVariable(itor->comm_start, dst_memnode_container, "bw", current_bandwidth_per_node[itor->dst_node]);
+#else
+			fprintf(out_paje_file, "13	%.9f	%smn%u	bw	%f\n",
 				itor->comm_start, prefix, itor->dst_node, current_bandwidth_per_node[itor->dst_node]);
+#endif
+		}
 	}
 }
 
@@ -877,13 +1051,28 @@ void starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *opt
 	/* create the "program" container */
 	if (out_paje_file)
 	{
-		fprintf(out_paje_file, "7      0.0 %sp      P      MPIroot       program%s \n", prefix, prefix);
+#ifdef STARPU_HAVE_POTI
+		char new_program_container_alias[STARPU_POTI_STR_LEN], new_program_container_name[STARPU_POTI_STR_LEN];
+		program_container_alias(new_program_container_alias, STARPU_POTI_STR_LEN, prefix);
+		snprintf(new_program_container_name, STARPU_POTI_STR_LEN, "program %s", prefix);
+		poti_CreateContainer (0, new_program_container_alias, "P", "MPIroot", new_program_container_name);
+		if (!options->no_counter)
+		{
+			char new_scheduler_container_alias[STARPU_POTI_STR_LEN], new_scheduler_container_name[STARPU_POTI_STR_LEN];
+			scheduler_container_alias(new_scheduler_container_alias, STARPU_POTI_STR_LEN, prefix);
+			snprintf(new_scheduler_container_name, STARPU_POTI_STR_LEN, "scheduler %s", prefix);
+			poti_CreateContainer(0.0, new_scheduler_container_alias, "Sc", new_program_container_alias, new_scheduler_container_name);
+			poti_SetVariable(0.0, new_scheduler_container_alias, "ntask", 0.0);
+		}
+#else
+		fprintf(out_paje_file, "7	0.0	%sp	P	MPIroot	program%s \n", prefix, prefix);
 		/* create a variable with the number of tasks */
 		if (!options->no_counter)
 		{
-			fprintf(out_paje_file, "7     %f    %ssched   Sc    %sp     scheduler \n", 0.0, prefix, prefix);
-			fprintf(out_paje_file, "13    0.0    ntask %ssched 0.0\n", prefix);
+			fprintf(out_paje_file, "7	%.9f	%ssched	Sc	%sp	scheduler\n", 0.0, prefix, prefix);
+			fprintf(out_paje_file, "13	0.0	%ssched	ntask	0.0\n", prefix);
 		}
+#endif
 	}
 
 	struct fxt_ev_64 ev;
@@ -1155,6 +1344,9 @@ void starpu_fxt_paje_file_init(struct starpu_fxt_options *options)
 			exit(1);
 		}
 
+#ifdef STARPU_HAVE_POTI
+		poti_init (out_paje_file);
+#endif
 		_starpu_fxt_write_paje_header(out_paje_file);
 	}
 	else

+ 18 - 2
src/debug/traces/starpu_fxt_mpi.c

@@ -1,5 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
+ * Copyright (C) 2012  Université Bordeaux 1
  * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -20,6 +21,10 @@
 #ifdef STARPU_USE_FXT
 
 #include "starpu_fxt.h"
+#ifdef STARPU_HAVE_POTI
+#include <poti.h>
+#define STARPU_POTI_STR_LEN 200
+#endif
 
 struct mpi_transfer
 {
@@ -219,8 +224,19 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, int src)
 			/* TODO replace 0 by a MPI program ? */
 			if (out_paje_file)
 			{
-				fprintf(out_paje_file, "18	%f	MPIL	MPIroot   %ld	mpi_%d_p	mpicom_%lu\n", start_date, size, /* XXX */src, id);
-				fprintf(out_paje_file, "19	%f	MPIL	MPIroot	  %ld	mpi_%d_p	mpicom_%lu\n", end_date, size, /* XXX */dst, id);
+#ifdef STARPU_HAVE_POTI
+				char paje_value[STARPU_POTI_STR_LEN], paje_key[STARPU_POTI_STR_LEN];
+				snprintf(paje_value, STARPU_POTI_STR_LEN, "%lu", (long unsigned) size);
+				snprintf(paje_key, STARPU_POTI_STR_LEN, "mpicom_%lu", id);
+				char mpi_container[STARPU_POTI_STR_LEN];
+				snprintf(mpi_container, sizeof(mpi_container), "mpi_%d_p", /* XXX */src);
+				poti_StartLink(start_date, "MPIroot", "MPIL", mpi_container, paje_value, paje_key);
+				snprintf(mpi_container, sizeof(mpi_container), "mpi_%d_p", /* XXX */dst);
+				poti_EndLink(end_date, "MPIroot", "MPIL", mpi_container, paje_value, paje_key);
+#else
+				fprintf(out_paje_file, "18	%.9f	MPIL	MPIroot	%ld	mpi_%d_p	mpicom_%lu\n", start_date, size, /* XXX */src, id);
+				fprintf(out_paje_file, "19	%.9f	MPIL	MPIroot	%ld	mpi_%d_p	mpicom_%lu\n", end_date, size, /* XXX */dst, id);
+#endif
 			}
 		}
 		else

+ 109 - 120
src/debug/traces/starpu_paje.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2012  Université de Bordeaux 1
  *
  * 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
@@ -16,11 +16,18 @@
 
 #include "starpu_fxt.h"
 #include <common/config.h>
+#ifdef STARPU_HAVE_POTI
+#include <poti.h>
+#endif
 
 #ifdef STARPU_USE_FXT
 
 void _starpu_fxt_write_paje_header(FILE *file)
 {
+	unsigned i;
+#ifdef STARPU_HAVE_POTI
+	poti_header(1); /* 1 as parameter means basic, no extended events */
+#else
 	fprintf(file, "%%EventDef	PajeDefineContainerType	1\n");
 	fprintf(file, "%%	Alias	string\n");
 	fprintf(file, "%%	ContainerType	string\n");
@@ -74,8 +81,8 @@ void _starpu_fxt_write_paje_header(FILE *file)
 	fprintf(file, "%%EndEventDef\n");
 	fprintf(file, "%%EventDef PajeSetState 10\n");
 	fprintf(file, "%%	Time	date\n");
-	fprintf(file, "%%	Type	string\n");
 	fprintf(file, "%%	Container	string\n");
+	fprintf(file, "%%	Type	string\n");
 	fprintf(file, "%%	Value	string\n");
 	fprintf(file, "%%EndEventDef\n");
 	fprintf(file, "%%EventDef	PajePushState	11\n");
@@ -91,8 +98,8 @@ void _starpu_fxt_write_paje_header(FILE *file)
 	fprintf(file, "%%EndEventDef\n");
 	fprintf(file, "%%EventDef	PajeSetVariable	13\n");
 	fprintf(file, "%%	Time	date\n");
-	fprintf(file, "%%	Type	string\n");
 	fprintf(file, "%%	Container	string\n");
+	fprintf(file, "%%	Type	string\n");
 	fprintf(file, "%%	Value	double\n");
 	fprintf(file, "%%EndEventDef\n");
 	fprintf(file, "%%EventDef	PajeAddVariable	14\n");
@@ -123,126 +130,108 @@ void _starpu_fxt_write_paje_header(FILE *file)
 	fprintf(file, "%%	DestContainer	string\n");
 	fprintf(file, "%%	Key	string\n");
 	fprintf(file, "%%EndEventDef\n");
+#endif
+
+#ifdef STARPU_HAVE_POTI
+	poti_DefineContainerType("MPIP", "0", "MPI Program");
+	poti_DefineContainerType("P", "MPIP", "Program");
+	poti_DefineContainerType("Mn", "P", "Memory Node");
+	poti_DefineContainerType("T", "Mn", "Worker");
+	poti_DefineContainerType("Sc", "P", "Scheduler");
 
-	fprintf(file, "                                        \n \
-	1       MPIP      0       \"MPI Program\"                      	\n \
-	1       P      MPIP       \"Program\"                      	\n \
-	1       Mn      P       \"Memory Node\"                         \n \
-	1       T      Mn       \"Worker\"                               \n \
-	1       Sc       P       \"Scheduler State\"                        \n \
-	2       event   T       \"event type\"				\n \
-	3       S       T       \"Thread State\"                        \n \
-	3       Ctx1      T     \"InCtx1\"         		\n \
-	3       Ctx2      T     \"InCtx2\"         		\n \
-	3       Ctx3      T     \"InCtx3\"         		\n \
-	3       Ctx4      T     \"InCtx4\"         		\n \
-	3       Ctx5      T     \"InCtx5\"         		\n \
-	3       Ctx6      T     \"InCtx6\"         		\n \
-	3       Ctx7      T     \"InCtx7\"         		\n \
-	3       Ctx8      T     \"InCtx8\"         		\n \
-	3       Ctx9      T     \"InCtx9\"         		\n \
-	3       Ctx10     T     \"InCtx10\"         		\n \
-	3       MS       Mn       \"Memory Node State\"                        \n \
-	4       ntask    Sc       \"Number of tasks\"                        \n \
-	4       bw      Mn       \"Bandwidth\"                        \n \
-	6       I       S      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       S      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       S      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       S      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       S       Callback       \".0 .3 .8\"            \n \
-	6       B       S       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       S      Sleeping         \".9 .1 .0\"		\n \
-	6       P       S       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx1      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx1      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx1      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx1      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx1       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx1       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx1      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx1       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx2      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx2      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx2      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx2      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx2       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx2       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx2      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx2       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx3      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx3      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx3      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx3      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx3       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx3       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx3      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx3       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx4      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx4      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx4      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx4      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx4       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx4       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx4      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx4       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx5      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx5      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx5      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx5      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx5       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx5       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx5      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx5       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx6      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx6      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx6      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx6      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx6       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx6       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx6      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx6       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx7      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx7      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx7      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx7      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx7       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx7       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx7      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx7       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx8      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx8      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx8      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx8      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx8       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx8       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx8      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx8       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx9      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx9      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx9      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx9      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx9       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx9       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx9      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx9       Progressing         \".4 .1 .6\"		\n \
-	6       I       Ctx10      Initializing       \"0.0 .7 1.0\"            \n \
-	6       D       Ctx10      Deinitializing       \"0.0 .1 .7\"            \n \
-	6       Fi       Ctx10      FetchingInput       \"1.0 .1 1.0\"            \n \
-	6       Po       Ctx10      PushingOutput       \"0.1 1.0 1.0\"            \n \
-	6       C       Ctx10       Callback       \".0 .3 .8\"            \n \
-	6       B       Ctx10       Blocked         \".9 .1 .0\"		\n \
-	6       Sl       Ctx10      Sleeping         \".9 .1 .0\"		\n \
-	6       P       Ctx10       Progressing         \".4 .1 .6\"		\n \
-	6       A       MS      Allocating         \".4 .1 .0\"		\n \
-	6       Ar       MS      AllocatingReuse       \".1 .1 .8\"		\n \
-	6       R       MS      Reclaiming         \".0 .1 .4\"		\n \
-	6       Co       MS     DriverCopy         \".3 .5 .1\"		\n \
-	6       CoA      MS     DriverCopyAsync         \".1 .3 .1\"		\n \
-	6       No       MS     Nothing         \".0 .0 .0\"		\n \
-	5       MPIL     MPIP	P	P      MPIL\n \
-	5       L       P	Mn	Mn      L\n");
+	/* Types for the memory node */
+	poti_DefineVariableType("bw", "Mn", "Bandwidth", "0 0 0");
+	poti_DefineStateType("MS", "Mn", "Memory Node State");
+	poti_DefineEntityValue("A", "MS", "Allocating", ".4 .1 .0");
+	poti_DefineEntityValue("Ar", "MS", "AllocatingReuse", ".1 .1 .8");
+	poti_DefineEntityValue("R", "MS", "Reclaiming", ".0 .1 .4");
+	poti_DefineEntityValue("Co", "MS", "DriverCopy", ".3 .5 .1");
+	poti_DefineEntityValue("CoA", "MS", "DriverCopyAsync", ".1 .3 .1");
+	poti_DefineEntityValue("No", "MS", "Nothing", ".0 .0 .0");
+
+	/* Types for the Worker of the Memory Node */
+	poti_DefineEventType("event", "T", "event type");
+	poti_DefineStateType("S", "T", "Thread State");
+	poti_DefineEntityValue("I", "S", "Initializing", "0.0 .7 1.0");
+	poti_DefineEntityValue("D", "S", "Deinitializing", "0.0 .1 .7");
+	poti_DefineEntityValue("Fi", "S", "FetchingInput", "1.0 .1 1.0");
+	poti_DefineEntityValue("Po", "S", "PushingOutput", "0.1 1.0 1.0");
+	poti_DefineEntityValue("C", "S", "Callback", ".0 .3 .8");
+	poti_DefineEntityValue("B", "S", "Blocked", ".9 .1 .0");
+	poti_DefineEntityValue("Sl", "S", "Sleeping", ".9 .1 .0");
+	poti_DefineEntityValue("P", "S", "Progressing", ".4 .1 .6");
+
+	for (i=1; i<=10; i++)
+	{
+		char inctx[8];
+		snprintf(inctx, sizeof(inctx), "InCtx%u", i);
+		char *ctx = inctx+2;
+		poti_DefineStateType(ctx, "T", inctx);
+		poti_DefineEntityValue("I", ctx, "Initializing", "0.0 .7 1.0");
+		poti_DefineEntityValue("D", ctx, "Deinitializing", "0.0 .1 .7");
+		poti_DefineEntityValue("Fi", ctx, "FetchingInput", "1.0 .1 1.0");
+		poti_DefineEntityValue("Po", ctx, "PushingOutput", "0.1 1.0 1.0");
+		poti_DefineEntityValue("C", ctx, "Callback", ".0 .3 .8");
+		poti_DefineEntityValue("B", ctx, "Blocked", ".9 .1 .0");
+		poti_DefineEntityValue("Sl", ctx, "Sleeping", ".9 .1 .0");
+		poti_DefineEntityValue("P", ctx, "Progressing", ".4 .1 .6");
+	}
+
+	/* Types for the Scheduler */
+	poti_DefineVariableType("ntask", "Sc", "Number of tasks", "0 0 0");
+
+	/* Link types */
+	poti_DefineLinkType("MPIL", "MPIP", "P", "P", "Links between two MPI programs");
+	poti_DefineLinkType("L", "P", "Mn", "Mn", "Links between two Memory Nodes");
+
+	/* Creating the MPI Program */
+	poti_CreateContainer(0, "MPIroot", "MPIP", "0", "root");
+#else
+	fprintf(file, "                                        \n\
+1       MPIP      0       \"MPI Program\"                      	\n\
+1       P      MPIP       \"Program\"                      	\n\
+1       Mn      P       \"Memory Node\"                         \n\
+1       T      Mn       \"Worker\"                               \n\
+1       Sc       P       \"Scheduler State\"                        \n\
+2       event   T       \"event type\"				\n\
+3       S       T       \"Thread State\"                        \n");
+	for (i=1; i<=10; i++)
+		fprintf(file, "3       Ctx%u      T     \"InCtx%u\"         		\n", i, i);
+	fprintf(file, "\
+3       MS       Mn       \"Memory Node State\"                        \n\
+4       ntask    Sc       \"Number of tasks\"                        \n\
+4       bw      Mn       \"Bandwidth\"                        \n\
+6       I       S      Initializing       \"0.0 .7 1.0\"            \n\
+6       D       S      Deinitializing       \"0.0 .1 .7\"            \n\
+6       Fi       S      FetchingInput       \"1.0 .1 1.0\"            \n\
+6       Po       S      PushingOutput       \"0.1 1.0 1.0\"            \n\
+6       C       S       Callback       \".0 .3 .8\"            \n\
+6       B       S       Blocked         \".9 .1 .0\"		\n\
+6       Sl       S      Sleeping         \".9 .1 .0\"		\n\
+6       P       S       Progressing         \".4 .1 .6\"		\n");
+	for (i=1; i<=10; i++)
+		fprintf(file, "\
+6       I       Ctx%u      Initializing       \"0.0 .7 1.0\"            \n\
+6       D       Ctx%u      Deinitializing       \"0.0 .1 .7\"            \n\
+6       Fi       Ctx%u      FetchingInput       \"1.0 .1 1.0\"            \n\
+6       Po       Ctx%u      PushingOutput       \"0.1 1.0 1.0\"            \n\
+6       C       Ctx%u       Callback       \".0 .3 .8\"            \n\
+6       B       Ctx%u       Blocked         \".9 .1 .0\"		\n\
+6       Sl       Ctx%u      Sleeping         \".9 .1 .0\"		\n\
+6       P       Ctx%u       Progressing         \".4 .1 .6\"		\n",
+		i, i, i, i, i, i, i, i);
+	fprintf(file, "\
+6       A       MS      Allocating         \".4 .1 .0\"		\n\
+6       Ar       MS      AllocatingReuse       \".1 .1 .8\"		\n\
+6       R       MS      Reclaiming         \".0 .1 .4\"		\n\
+6       Co       MS     DriverCopy         \".3 .5 .1\"		\n\
+6       CoA      MS     DriverCopyAsync         \".1 .3 .1\"		\n\
+6       No       MS     Nothing         \".0 .0 .0\"		\n\
+5       MPIL     MPIP	P	P      MPIL\n\
+5       L       P	Mn	Mn      L\n");
 
 	fprintf(file, "7      0.0 MPIroot      MPIP      0       root\n");
+#endif
 }
 
 #endif