Browse Source

Avoid crashing when opening one trace of an MPI execution

Samuel Thibault 9 years ago
parent
commit
d31c25da38
1 changed files with 22 additions and 2 deletions
  1. 22 2
      src/debug/traces/starpu_fxt.c

+ 22 - 2
src/debug/traces/starpu_fxt.c

@@ -2093,6 +2093,7 @@ static void handle_mpi_isend_submit_begin(struct fxt_ev_64 *ev, struct starpu_fx
 		recfmt_mpicommthread_set_state(date, "SdS");
 		recfmt_mpicommthread_set_state(date, "SdS");
 }
 }
 
 
+static int mpi_warned;
 static void handle_mpi_isend_submit_end(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 static void handle_mpi_isend_submit_end(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 {
 {
 	int dest = ev->param[0];
 	int dest = ev->param[0];
@@ -2105,7 +2106,16 @@ static void handle_mpi_isend_submit_end(struct fxt_ev_64 *ev, struct starpu_fxt_
 	if (trace_file)
 	if (trace_file)
 		recfmt_mpicommthread_set_state(date, "P");
 		recfmt_mpicommthread_set_state(date, "P");
 
 
-	_starpu_fxt_mpi_add_send_transfer(options->file_rank, dest, mpi_tag, size, date);
+	if (options->file_rank < 0)
+	{
+		if (!mpi_warned)
+		{
+			fprintf(stderr,"error while opening %s\n", options->out_paje_path);
+			mpi_warned = 1;
+		}
+	}
+	else
+		_starpu_fxt_mpi_add_send_transfer(options->file_rank, dest, mpi_tag, size, date);
 }
 }
 
 
 static void handle_mpi_irecv_submit_begin(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 static void handle_mpi_irecv_submit_begin(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
@@ -2158,7 +2168,17 @@ static void handle_mpi_irecv_complete_begin(struct fxt_ev_64 *ev, struct starpu_
 		mpicommthread_set_state(date, options->file_prefix, "RvC");
 		mpicommthread_set_state(date, options->file_prefix, "RvC");
 	if (trace_file)
 	if (trace_file)
 		recfmt_mpicommthread_set_state(date, "RvC");
 		recfmt_mpicommthread_set_state(date, "RvC");
-	_starpu_fxt_mpi_add_recv_transfer(src, options->file_rank, mpi_tag, date);
+
+	if (options->file_rank < 0)
+	{
+		if (!mpi_warned)
+		{
+			fprintf(stderr,"error while opening %s\n", options->out_paje_path);
+			mpi_warned = 1;
+		}
+	}
+	else
+		_starpu_fxt_mpi_add_recv_transfer(src, options->file_rank, mpi_tag, date);
 }
 }
 
 
 static void handle_mpi_irecv_complete_end(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 static void handle_mpi_irecv_complete_end(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)