瀏覽代碼

fix leaking data when data_file or tasks_file is disabled. Also fix crash when disabling task_file

Samuel Thibault 8 年之前
父節點
當前提交
758045543f
共有 2 個文件被更改,包括 9 次插入4 次删除
  1. 7 3
      src/debug/traces/starpu_fxt.c
  2. 2 1
      src/profiling/bound.c

+ 7 - 3
src/debug/traces/starpu_fxt.c

@@ -157,6 +157,8 @@ static void task_dump(struct task_info *task)
 
 	if (task->exclude_from_dag)
 		goto out;
+	if (!tasks_file)
+		goto out;
 
 	if (task->name)
 	{
@@ -274,6 +276,8 @@ static struct data_info *get_data(unsigned long handle, int mpi_rank)
 
 static void data_dump(struct data_info *data)
 {
+	if (!data_file)
+		goto out;
 	fprintf(data_file, "Handle: %lx\n", data->handle);
 	fprintf(data_file, "MPIRank: %d\n", data->mpi_rank);
 	if (data->name)
@@ -291,6 +295,7 @@ static void data_dump(struct data_info *data)
 	}
 	fprintf(data_file, "MPIOwner: %d\n", data->mpi_owner);
 	fprintf(data_file, "\n");
+out:
 	HASH_DEL(data_info, data);
 	free(data);
 }
@@ -2388,8 +2393,8 @@ static void handle_task_done(struct fxt_ev_64 *ev, struct starpu_fxt_options *op
 	unsigned exclude_from_dag = ev->param[2];
 	struct task_info *task = get_task(job_id, options->file_rank);
 	task->exclude_from_dag = exclude_from_dag;
-	if (tasks_file)
-		task_dump(task);
+
+	task_dump(task);
 
 	if (!exclude_from_dag)
 		_starpu_fxt_dag_set_task_done(options->file_prefix, job_id, name, colour);
@@ -3479,7 +3484,6 @@ void _starpu_fxt_parse_new_file(char *filename_in, struct starpu_fxt_options *op
 #endif
 	}
 
-	if (data_file)
 	{
 		/* TODO: move to handle_data_unregister */
 		struct data_info *data, *tmp;

+ 2 - 1
src/profiling/bound.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011, 2012, 2013, 2016, 2017  CNRS
- * Copyright (C) 2010-2016  Université de Bordeaux
+ * Copyright (C) 2010-2017  Université de Bordeaux
  * Copyright (C) 2011  Télécom-SudParis
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -278,6 +278,7 @@ void _starpu_bound_record(struct _starpu_job *j)
 	{
 		struct bound_task_pool *tp;
 
+		/* FIXME: bogus STARPU_CPU_WORKER parameter for arch pointer */
 		_starpu_compute_buffers_footprint(j->task->cl?j->task->cl->model:NULL, STARPU_CPU_WORKER, 0, j);
 
 		if (last && last->cl == j->task->cl && last->footprint == j->footprint)