Bladeren bron

fxt: fix traces with communication uncompleted at trace end

Samuel Thibault 5 jaren geleden
bovenliggende
commit
7bf733f327
1 gewijzigde bestanden met toevoegingen van 31 en 0 verwijderingen
  1. 31 0
      src/debug/traces/starpu_fxt.c

+ 31 - 0
src/debug/traces/starpu_fxt.c

@@ -499,6 +499,7 @@ LIST_TYPE(_starpu_communication,
 	double bandwidth;
 	unsigned src_node;
 	unsigned dst_node;
+	unsigned long size;
 	const char *type;
 	unsigned long handle;
 	struct _starpu_communication *peer;
@@ -2314,6 +2315,7 @@ static void handle_start_driver_copy(struct fxt_ev_64 *ev, struct starpu_fxt_opt
 		struct _starpu_communication *com = _starpu_communication_new();
 		com->comid = comid;
 		com->comm_start = get_event_time_stamp(ev, options);
+		com->size = size;
 
 		com->src_node = src;
 		com->dst_node = dst;
@@ -2392,6 +2394,7 @@ static void handle_end_driver_copy(struct fxt_ev_64 *ev, struct starpu_fxt_optio
 				com->comid = comid;
 				com->comm_start = get_event_time_stamp(ev, options);
 				com->bandwidth = -bandwidth;
+				com->size = size;
 
 				src = com->src_node = itor->src_node;
 				com->dst_node = itor->dst_node;
@@ -4144,6 +4147,34 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
 		_starpu_fxt_process_computations(options);
 	}
 
+	if (out_paje_file && !options->no_bus)
+	{
+		while (!_starpu_communication_list_empty(&communication_list)) {
+			struct _starpu_communication*itor;
+			itor = _starpu_communication_list_pop_front(&communication_list);
+
+			/* Trace finished with this communication uncompleted, fake its termination */
+
+			unsigned comid = itor->comid;
+			unsigned long size = itor->size;
+			unsigned dst = itor->dst_node;
+			double time = current_computation_time;
+			const char *link_type = itor->type;
+#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];
+			snprintf(paje_value, sizeof(paje_value), "%lu", size);
+			snprintf(paje_key, sizeof(paje_key), "com_%u", comid);
+			program_container_alias(program_container, STARPU_POTI_STR_LEN, prefix);
+			memmanager_container_alias(dst_memnode_container, STARPU_POTI_STR_LEN, prefix, dst);
+			poti_EndLink(time, program_container, link_type, dst_memnode_container, paje_value, paje_key);
+#else
+			fprintf(out_paje_file, "19	%.9f	%s	%sp	%lu	%smm%u	com_%u\n", time, link_type, prefix, size, prefix, dst, comid);
+#endif
+			_starpu_communication_delete(itor);
+		}
+	}
+
 	if (out_paje_file && !options->no_flops)
 	{
 		unsigned i;