|
@@ -279,6 +279,7 @@ static void task_dump(struct task_info *task, struct starpu_fxt_options *options
|
|
|
for (i = 0; i < task->ndata; i++)
|
|
|
fprintf(tasks_file, " %lu", task->data[i].size);
|
|
|
fprintf(tasks_file, "\n");
|
|
|
+ free(task->data);
|
|
|
}
|
|
|
fprintf(tasks_file, "MPIRank: %d\n", task->mpi_rank);
|
|
|
fprintf(tasks_file, "\n");
|
|
@@ -447,23 +448,23 @@ static const char *get_worker_color(int workerid)
|
|
|
return worker_colors[workerid];
|
|
|
}
|
|
|
|
|
|
-static unsigned get_colour_symbol_red(char *name)
|
|
|
+static unsigned get_color_symbol_red(char *name)
|
|
|
{
|
|
|
- /* choose some colour ... that's disguting yes */
|
|
|
+ /* choose some color ... that's disguting yes */
|
|
|
uint32_t hash_symbol = starpu_hash_crc32c_string(name, 0);
|
|
|
return (unsigned)starpu_hash_crc32c_string("red", hash_symbol) % 1024;
|
|
|
}
|
|
|
|
|
|
-static unsigned get_colour_symbol_green(char *name)
|
|
|
+static unsigned get_color_symbol_green(char *name)
|
|
|
{
|
|
|
- /* choose some colour ... that's disguting yes */
|
|
|
+ /* choose some color ... that's disguting yes */
|
|
|
uint32_t hash_symbol = starpu_hash_crc32c_string(name, 0);
|
|
|
return (unsigned)starpu_hash_crc32c_string("green", hash_symbol) % 1024;
|
|
|
}
|
|
|
|
|
|
-static unsigned get_colour_symbol_blue(char *name)
|
|
|
+static unsigned get_color_symbol_blue(char *name)
|
|
|
{
|
|
|
- /* choose some colour ... that's disguting yes */
|
|
|
+ /* choose some color ... that's disguting yes */
|
|
|
uint32_t hash_symbol = starpu_hash_crc32c_string(name, 0);
|
|
|
return (unsigned)starpu_hash_crc32c_string("blue", hash_symbol) % 1024;
|
|
|
}
|
|
@@ -680,9 +681,7 @@ static int prefixTOnodeid (const char *prefix)
|
|
|
//if we are a single-node trace, prefix is empty, so return 0
|
|
|
if (strcmp(prefix, "")==0) return 0;
|
|
|
|
|
|
- char *str;
|
|
|
- _STARPU_MALLOC(str, sizeof(char)*strlen(prefix));
|
|
|
- strncpy (str, prefix, strlen(prefix));
|
|
|
+ char *str = strdup(prefix);
|
|
|
str[strlen(prefix)-1] = '\0';
|
|
|
unsigned long nodeid = atoi(str);
|
|
|
free(str);
|
|
@@ -1420,10 +1419,10 @@ static void create_paje_state_if_not_found(char *name, unsigned color, struct st
|
|
|
|
|
|
_starpu_symbol_name_list_push_front(&symbol_list, entry);
|
|
|
|
|
|
- /* choose some colour ... that's disguting yes */
|
|
|
- unsigned hash_symbol_red = get_colour_symbol_red(name);
|
|
|
- unsigned hash_symbol_green = get_colour_symbol_green(name);
|
|
|
- unsigned hash_symbol_blue = get_colour_symbol_blue(name);
|
|
|
+ /* choose some color ... that's disguting yes */
|
|
|
+ unsigned hash_symbol_red = get_color_symbol_red(name);
|
|
|
+ unsigned hash_symbol_green = get_color_symbol_green(name);
|
|
|
+ unsigned hash_symbol_blue = get_color_symbol_blue(name);
|
|
|
|
|
|
uint32_t hash_sum = hash_symbol_red + hash_symbol_green + hash_symbol_blue;
|
|
|
|
|
@@ -1544,7 +1543,7 @@ static void handle_start_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_op
|
|
|
unsigned long has_name = ev->param[4];
|
|
|
char *name = has_name?get_fxt_string(ev, 5):"unknown";
|
|
|
|
|
|
- snprintf(_starpu_last_codelet_symbol[worker], sizeof(_starpu_last_codelet_symbol[worker])-1, "%s", name);
|
|
|
+ snprintf(_starpu_last_codelet_symbol[worker], sizeof(_starpu_last_codelet_symbol[worker]), "%.*s", (int) sizeof(_starpu_last_codelet_symbol[worker])-1, name);
|
|
|
_starpu_last_codelet_symbol[worker][sizeof(_starpu_last_codelet_symbol[worker])-1] = 0;
|
|
|
last_codelet_parameter[worker] = 0;
|
|
|
|
|
@@ -1621,7 +1620,7 @@ static void handle_codelet_data(struct fxt_ev_64 *ev STARPU_ATTRIBUTE_UNUSED, st
|
|
|
if (num >= MAX_PARAMETERS)
|
|
|
return;
|
|
|
char *name = get_fxt_string(ev, 1);
|
|
|
- snprintf(last_codelet_parameter_description[worker][num], sizeof(last_codelet_parameter_description[worker][num])-1, "%s", name);
|
|
|
+ snprintf(last_codelet_parameter_description[worker][num], sizeof(last_codelet_parameter_description[worker][num]), "%.*s", (int) sizeof(last_codelet_parameter_description[worker][num])-1, name);
|
|
|
last_codelet_parameter_description[worker][num][sizeof(last_codelet_parameter_description[worker][num])-1] = 0;
|
|
|
}
|
|
|
|
|
@@ -1766,7 +1765,7 @@ static void handle_end_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_opti
|
|
|
size_t codelet_size = ev->param[1];
|
|
|
uint32_t codelet_hash = ev->param[2];
|
|
|
long unsigned int threadid = ev->param[4];
|
|
|
- char *name = get_fxt_string(ev, 4);
|
|
|
+ char *name = get_fxt_string(ev, 5);
|
|
|
|
|
|
const char *state = "I";
|
|
|
if (find_sync(prefixTOnodeid(prefix), threadid))
|
|
@@ -1852,7 +1851,7 @@ static void handle_end_codelet_body(struct fxt_ev_64 *ev, struct starpu_fxt_opti
|
|
|
snprintf(dumped_codelets[dumped_codelets_count - 1].symbol, sizeof(dumped_codelets[dumped_codelets_count - 1].symbol)-1, "%s", _starpu_last_codelet_symbol[worker]);
|
|
|
dumped_codelets[dumped_codelets_count - 1].symbol[sizeof(dumped_codelets[dumped_codelets_count - 1].symbol)-1] = 0;
|
|
|
dumped_codelets[dumped_codelets_count - 1].workerid = worker;
|
|
|
- snprintf(dumped_codelets[dumped_codelets_count - 1].perfmodel_archname, sizeof(dumped_codelets[dumped_codelets_count - 1].perfmodel_archname)-1, "%s", name);
|
|
|
+ snprintf(dumped_codelets[dumped_codelets_count - 1].perfmodel_archname, sizeof(dumped_codelets[dumped_codelets_count - 1].perfmodel_archname), "%.*s", (int) sizeof(dumped_codelets[dumped_codelets_count - 1].perfmodel_archname)-1, name);
|
|
|
dumped_codelets[dumped_codelets_count - 1].perfmodel_archname[sizeof(dumped_codelets[dumped_codelets_count - 1].perfmodel_archname)-1] = 0;
|
|
|
dumped_codelets[dumped_codelets_count - 1].size = codelet_size;
|
|
|
dumped_codelets[dumped_codelets_count - 1].hash = codelet_hash;
|
|
@@ -2826,7 +2825,7 @@ static void handle_task_deps(struct fxt_ev_64 *ev, struct starpu_fxt_options *op
|
|
|
task->ndeps++;
|
|
|
|
|
|
/* There is a dependency between both job id : dep_prev -> dep_succ */
|
|
|
- if (show_task(task, options))
|
|
|
+ if (show_task(task, options) && show_task(prev_task, options))
|
|
|
{
|
|
|
if (!options->label_deps) name = NULL;
|
|
|
/* We should show the name of the predecessor, then. */
|
|
@@ -2862,47 +2861,49 @@ static void handle_task_color(struct fxt_ev_64 *ev, struct starpu_fxt_options *o
|
|
|
task->color = color;
|
|
|
}
|
|
|
|
|
|
-static void handle_task_name(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
|
|
|
+static void handle_task_exclude_from_dag(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
|
|
|
{
|
|
|
- char *prefix = options->file_prefix;
|
|
|
-
|
|
|
unsigned long job_id = ev->param[0];
|
|
|
+ unsigned exclude_from_dag = ev->param[1];
|
|
|
+
|
|
|
struct task_info *task = get_task(job_id, options->file_rank);
|
|
|
+ task->exclude_from_dag = exclude_from_dag;
|
|
|
+}
|
|
|
|
|
|
- unsigned long has_name = ev->param[3];
|
|
|
- char *name = has_name?get_fxt_string(ev,4):"unknown";
|
|
|
+static void handle_task_name(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
|
|
|
+{
|
|
|
+ unsigned long job_id = ev->param[0];
|
|
|
+ char *name = get_fxt_string(ev,1);
|
|
|
|
|
|
- int worker;
|
|
|
- worker = find_worker_id(prefixTOnodeid(prefix), ev->param[1]);
|
|
|
+ char *prefix = options->file_prefix;
|
|
|
+ struct task_info *task = get_task(job_id, options->file_rank);
|
|
|
+ int worker = find_worker_id(prefixTOnodeid(prefix), ev->param[1]);
|
|
|
|
|
|
- const char *colour;
|
|
|
+ const char *color;
|
|
|
char buffer[32];
|
|
|
if (task->color != 0)
|
|
|
{
|
|
|
snprintf(buffer, sizeof(buffer), "#%06x", task->color);
|
|
|
- colour = &buffer[0];
|
|
|
+ color = &buffer[0];
|
|
|
}
|
|
|
else if (options->per_task_colour)
|
|
|
{
|
|
|
snprintf(buffer, sizeof(buffer), "#%x%x%x",
|
|
|
- get_colour_symbol_red(name)/4,
|
|
|
- get_colour_symbol_green(name)/4,
|
|
|
- get_colour_symbol_blue(name)/4);
|
|
|
- colour = &buffer[0];
|
|
|
+ get_color_symbol_red(name)/4,
|
|
|
+ get_color_symbol_green(name)/4,
|
|
|
+ get_color_symbol_blue(name)/4);
|
|
|
+ color = &buffer[0];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- colour= (worker < 0)?"#aaaaaa":get_worker_color(worker);
|
|
|
+ color= (worker < 0)?"#aaaaaa":get_worker_color(worker);
|
|
|
}
|
|
|
|
|
|
if (!task->name)
|
|
|
task->name = strdup(name);
|
|
|
|
|
|
- unsigned exclude_from_dag = ev->param[2];
|
|
|
- task->exclude_from_dag = exclude_from_dag;
|
|
|
-
|
|
|
- if (!exclude_from_dag && show_task(task, options))
|
|
|
- _starpu_fxt_dag_set_task_name(options->file_prefix, job_id, name, colour);
|
|
|
+ if (!task->exclude_from_dag && show_task(task, options))
|
|
|
+ _starpu_fxt_dag_set_task_name(options->file_prefix, job_id, task->name, color);
|
|
|
}
|
|
|
|
|
|
static void handle_task_done(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
|
|
@@ -2937,22 +2938,22 @@ static void handle_tag_done(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
|
|
|
int worker;
|
|
|
worker = find_worker_id(prefixTOnodeid(prefix), ev->param[1]);
|
|
|
|
|
|
- const char *colour;
|
|
|
+ const char *color;
|
|
|
char buffer[32];
|
|
|
if (options->per_task_colour)
|
|
|
{
|
|
|
snprintf(buffer, sizeof(buffer), "%.4f,%.4f,%.4f",
|
|
|
- get_colour_symbol_red(name)/1024.0,
|
|
|
- get_colour_symbol_green(name)/1024.0,
|
|
|
- get_colour_symbol_blue(name)/1024.0);
|
|
|
- colour = &buffer[0];
|
|
|
+ get_color_symbol_red(name)/1024.0,
|
|
|
+ get_color_symbol_green(name)/1024.0,
|
|
|
+ get_color_symbol_blue(name)/1024.0);
|
|
|
+ color = &buffer[0];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- colour= (worker < 0)?"white":get_worker_color(worker);
|
|
|
+ color= (worker < 0)?"white":get_worker_color(worker);
|
|
|
}
|
|
|
|
|
|
- _starpu_fxt_dag_set_tag_done(options->file_prefix, tag_id, colour);
|
|
|
+ _starpu_fxt_dag_set_tag_done(options->file_prefix, tag_id, color);
|
|
|
}
|
|
|
|
|
|
static void handle_mpi_barrier(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
|
|
@@ -3354,14 +3355,20 @@ static
|
|
|
void _starpu_fxt_process_bandwidth(struct starpu_fxt_options *options)
|
|
|
{
|
|
|
char *prefix = options->file_prefix;
|
|
|
+ struct _starpu_communication *itor, *next;
|
|
|
|
|
|
/* Loop through completed communications */
|
|
|
- while (!_starpu_communication_list_empty(&communication_list)
|
|
|
- && _starpu_communication_list_begin(&communication_list)->peer)
|
|
|
+ for (itor = _starpu_communication_list_begin(&communication_list);
|
|
|
+ itor != _starpu_communication_list_end(&communication_list);
|
|
|
+ itor = next)
|
|
|
{
|
|
|
- struct _starpu_communication*itor;
|
|
|
+ next = _starpu_communication_list_next(itor);
|
|
|
+
|
|
|
+ if (!itor->peer)
|
|
|
+ continue;
|
|
|
+
|
|
|
/* This communication is complete */
|
|
|
- itor = _starpu_communication_list_pop_front(&communication_list);
|
|
|
+ _starpu_communication_list_erase(&communication_list, itor);
|
|
|
|
|
|
current_bandwidth_out_per_node[itor->src_node] += itor->bandwidth;
|
|
|
if (out_paje_file)
|
|
@@ -3700,6 +3707,10 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
|
|
|
handle_task_submit_event(&ev, options, ev.param[0], NULL);
|
|
|
break;
|
|
|
|
|
|
+ case _STARPU_FUT_TASK_EXCLUDE_FROM_DAG:
|
|
|
+ handle_task_exclude_from_dag(&ev, options);
|
|
|
+ break;
|
|
|
+
|
|
|
case _STARPU_FUT_TASK_NAME:
|
|
|
handle_task_name(&ev, options);
|
|
|
break;
|
|
@@ -4136,10 +4147,10 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
|
|
|
_starpu_fxt_process_computations(options);
|
|
|
}
|
|
|
|
|
|
+ unsigned i;
|
|
|
if (!options->no_flops)
|
|
|
{
|
|
|
- /* computations are supposed to be over, drop any pending comp */
|
|
|
- unsigned i;
|
|
|
+ /* computations are supposed to be over, unref any pending comp */
|
|
|
for (i = 0; i < STARPU_NMAXWORKERS; i++)
|
|
|
{
|
|
|
struct _starpu_computation *comp = ongoing_computation[i];
|
|
@@ -4147,13 +4158,23 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
|
|
|
{
|
|
|
STARPU_ASSERT(!comp->peer);
|
|
|
_starpu_computation_list_erase(&computation_list, comp);
|
|
|
- ongoing_computation[i] = 0;
|
|
|
}
|
|
|
}
|
|
|
/* And flush completed computations */
|
|
|
_starpu_fxt_process_computations(options);
|
|
|
}
|
|
|
|
|
|
+ for (i = 0; i < STARPU_NMAXWORKERS; i++)
|
|
|
+ {
|
|
|
+ struct _starpu_computation *comp = ongoing_computation[i];
|
|
|
+ if (comp)
|
|
|
+ {
|
|
|
+ STARPU_ASSERT(!comp->peer);
|
|
|
+ _starpu_computation_delete(comp);
|
|
|
+ ongoing_computation[i] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (out_paje_file && !options->no_bus)
|
|
|
{
|
|
|
while (!_starpu_communication_list_empty(&communication_list)) {
|
|
@@ -4184,7 +4205,6 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
|
|
|
|
|
|
if (out_paje_file && !options->no_flops)
|
|
|
{
|
|
|
- unsigned i;
|
|
|
for (i = 0; i < STARPU_NMAXWORKERS; i++)
|
|
|
{
|
|
|
if (last_codelet_end[i] != 0.0)
|
|
@@ -4228,12 +4248,23 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ for (i = 0; i < STARPU_NMAXWORKERS; i++)
|
|
|
+ free(options->worker_archtypes[i].devices);
|
|
|
+
|
|
|
+#ifdef HAVE_FXT_BLOCKEV_LEAVE
|
|
|
+ fxt_blockev_leave(block);
|
|
|
+#endif
|
|
|
+
|
|
|
/* Close the trace file */
|
|
|
+#ifdef HAVE_FXT_CLOSE
|
|
|
+ fxt_close(fut);
|
|
|
+#else
|
|
|
if (close(fd_in))
|
|
|
{
|
|
|
perror("close failed :");
|
|
|
exit(-1);
|
|
|
}
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/* Initialize FxT options to default values */
|
|
@@ -4651,12 +4682,20 @@ uint64_t _starpu_fxt_find_start_time(char *filename_in)
|
|
|
int ret = fxt_next_ev(block, FXT_EV_TYPE_64, (struct fxt_ev *)&ev);
|
|
|
STARPU_ASSERT (ret == FXT_EV_OK);
|
|
|
|
|
|
+#ifdef HAVE_FXT_BLOCKEV_LEAVE
|
|
|
+ fxt_blockev_leave(block);
|
|
|
+#endif
|
|
|
+
|
|
|
/* Close the trace file */
|
|
|
+#ifdef HAVE_FXT_CLOSE
|
|
|
+ fxt_close(fut);
|
|
|
+#else
|
|
|
if (close(fd_in))
|
|
|
{
|
|
|
perror("close failed :");
|
|
|
exit(-1);
|
|
|
}
|
|
|
+#endif
|
|
|
return (ev.time);
|
|
|
}
|
|
|
|
|
@@ -4838,7 +4877,7 @@ struct starpu_data_trace_kernel
|
|
|
|
|
|
static FILE *codelet_list;
|
|
|
|
|
|
-static void write_task(struct parse_task pt)
|
|
|
+static void write_task(char *dir, struct parse_task pt)
|
|
|
{
|
|
|
struct starpu_data_trace_kernel *kernel;
|
|
|
char *codelet_name = pt.codelet_name;
|
|
@@ -4848,11 +4887,13 @@ static void write_task(struct parse_task pt)
|
|
|
{
|
|
|
_STARPU_MALLOC(kernel, sizeof(*kernel));
|
|
|
kernel->name = strdup(codelet_name);
|
|
|
+ char filename[256];
|
|
|
+ snprintf(filename, sizeof(filename), "%s/%s", dir, kernel->name);
|
|
|
//fprintf(stderr, "%s\n", kernel->name);
|
|
|
- kernel->file = fopen(codelet_name, "w+");
|
|
|
+ kernel->file = fopen(filename, "w+");
|
|
|
if(!kernel->file)
|
|
|
{
|
|
|
- STARPU_ABORT_MSG("Failed to open '%s' (err %s)", codelet_name, strerror(errno));
|
|
|
+ STARPU_ABORT_MSG("Failed to open '%s' (err %s)", filename, strerror(errno));
|
|
|
}
|
|
|
HASH_ADD_STR(kernels, name, kernel);
|
|
|
fprintf(codelet_list, "%s\n", codelet_name);
|
|
@@ -4861,7 +4902,7 @@ static void write_task(struct parse_task pt)
|
|
|
fprintf(kernel->file, "%lf %u %u\n", time, pt.data_total, pt.workerid);
|
|
|
}
|
|
|
|
|
|
-void starpu_fxt_write_data_trace(char *filename_in)
|
|
|
+void starpu_fxt_write_data_trace_in_dir(char *filename_in, char *dir)
|
|
|
{
|
|
|
int fd_in;
|
|
|
fd_in = open(filename_in, O_RDONLY);
|
|
@@ -4878,10 +4919,12 @@ void starpu_fxt_write_data_trace(char *filename_in)
|
|
|
exit(-1);
|
|
|
}
|
|
|
|
|
|
- codelet_list = fopen("codelet_list", "w+");
|
|
|
+ char filename_out[512];
|
|
|
+ snprintf(filename_out, sizeof(filename_out), "%s/codelet_list", dir);
|
|
|
+ codelet_list = fopen(filename_out, "w+");
|
|
|
if(!codelet_list)
|
|
|
{
|
|
|
- STARPU_ABORT_MSG("Failed to open '%s' (err %s)", "codelet_list", strerror(errno));
|
|
|
+ STARPU_ABORT_MSG("Failed to open '%s' (err %s)", filename_out, strerror(errno));
|
|
|
}
|
|
|
|
|
|
fxt_blockev_t block;
|
|
@@ -4922,7 +4965,7 @@ void starpu_fxt_write_data_trace(char *filename_in)
|
|
|
workerid = ev.param[3];
|
|
|
assert(workerid != -1);
|
|
|
tasks[workerid].exec_time = ev.time - tasks[workerid].exec_time;
|
|
|
- write_task(tasks[workerid]);
|
|
|
+ write_task(dir, tasks[workerid]);
|
|
|
break;
|
|
|
|
|
|
case _STARPU_FUT_DATA_LOAD:
|
|
@@ -4939,14 +4982,19 @@ void starpu_fxt_write_data_trace(char *filename_in)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#ifdef HAVE_FXT_BLOCKEV_LEAVE
|
|
|
+ fxt_blockev_leave(block);
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef HAVE_FXT_CLOSE
|
|
|
fxt_close(fut);
|
|
|
-#endif
|
|
|
+#else
|
|
|
if (close(fd_in))
|
|
|
{
|
|
|
perror("close failed :");
|
|
|
exit(-1);
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
if(fclose(codelet_list))
|
|
|
{
|
|
@@ -4968,4 +5016,10 @@ void starpu_fxt_write_data_trace(char *filename_in)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+void starpu_fxt_write_data_trace(char *filename_in)
|
|
|
+{
|
|
|
+ starpu_fxt_write_data_trace_in_dir(filename_in, ".");
|
|
|
+}
|
|
|
+
|
|
|
#endif // STARPU_USE_FXT
|