From f38c5bc9dff65d0e9a666a846fe82f8d49669d84 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 30 Apr 2000 11:41:06 +0000 Subject: [PATCH] r20: Cleaned up debugging code --- src/ctrec.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/src/ctrec.c b/src/ctrec.c index f8c58ef..d270675 100644 --- a/src/ctrec.c +++ b/src/ctrec.c @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctrec.c,v 1.4 2000/04/30 10:13:27 kevin Exp $ +** $Id: ctrec.c,v 1.5 2000/04/30 11:41:06 kevin Exp $ ** $Log: ctrec.c,v $ +** Revision 1.5 2000/04/30 11:41:06 kevin +** Cleaned up debugging code +** ** Revision 1.4 2000/04/30 10:13:27 kevin ** Fixed MPI bugs ** @@ -253,9 +256,8 @@ main (const int argc, char *const argv[]) if (mpi_ct.my_rank == 0) { rs_global = raysum_open (rs_name); raysum_read (rs_global); - if (opt_verbose) { + if (opt_verbose) print_raysum_info(rs_global); - } mpi_ndet = rs_global->ndet; mpi_nview = rs_global->nview; @@ -290,16 +292,7 @@ main (const int argc, char *const argv[]) mpi_ct_calc_work_units(mpi_nview); - if (opt_debug) { - fprintf(stdout, "Calc'd local work units process %d: nviews=%d, local_work_units=%d, start_work_units=%d\n", - mpi_ct.my_rank, mpi_nview, mpi_ct.local_work_units[mpi_ct.my_rank], mpi_ct.start_work_unit[mpi_ct.my_rank]); - MPI_Barrier(mpi_ct.comm); - } - rs_local = raysum_create (NULL, mpi_ct.local_work_units[mpi_ct.my_rank], mpi_ndet); - if (opt_debug) { - fprintf(stdout, "Created rs_local %lx for process %d: local views=%4d, local dets=%4d\n", (unsigned long int) rs_local, mpi_ct.my_rank, mpi_ct.local_work_units[mpi_ct.my_rank], mpi_ndet); - } rs_local->ndet = mpi_ndet; rs_local->nview = mpi_nview; @@ -328,7 +321,7 @@ main (const int argc, char *const argv[]) #else rs_global = raysum_open (rs_name); raysum_read (rs_global); - if (opt_debug) + if (opt_verbose) print_raysum_info(rs_global); im_global = image_create (im_filename, nx, ny); @@ -340,14 +333,11 @@ main (const int argc, char *const argv[]) mpi_t1 = MPI_Wtime(); image_reconst (im_local, rs_local, opt_filter, opt_filter_param, opt_interp, opt_interp_param, opt_backproj, opt_trace); - if (opt_debug) - printf("Back from image_reconst in process %d\n", mpi_ct.my_rank); mpi_t2 = MPI_Wtime(); mpi_t = mpi_t2 - mpi_t1; MPI_Reduce(&mpi_t, &mpi_t_g, 1, MPI_DOUBLE, MPI_MAX, 0, mpi_ct.comm); - if (mpi_ct.my_rank == 0) { + if (mpi_ct.my_rank == 0 && opt_verbose) printf("Time to reconstruct = %f, Max time = %f\n", mpi_t, mpi_t_g); - } #else image_reconst (im_global, rs_global, opt_filter, opt_filter_param, opt_interp, opt_interp_param, opt_backproj, opt_trace); @@ -360,16 +350,15 @@ main (const int argc, char *const argv[]) if (opt_verbose) mpi_t1 = MPI_Wtime(); + for (ix = 0; ix < im_local->nx; ix++) { void *recvbuf = NULL; if (mpi_ct.my_rank == 0) recvbuf = im_global->v[ix]; - if (opt_debug) - printf("Calling MPI_Reduce in process %2d for ix=%d\n", mpi_ct.my_rank, ix); - MPI_Reduce(im_local->v[ix], recvbuf, im_local->ny, MPI_FLOAT, MPI_SUM, 0, mpi_ct.comm); } + if (opt_verbose) { mpi_t2 = MPI_Wtime(); mpi_t = mpi_t2 - mpi_t1; @@ -379,19 +368,18 @@ main (const int argc, char *const argv[]) } if (mpi_ct.my_rank == 0) { strncpy (im_global->remark, remark, MAXREMARK); - image_save (im_global); time_end = MPI_Wtime(); im_global->calctime = time_end - time_start; + image_save (im_global); if (opt_verbose) fprintf (stdout, "Time active = %.2f\n", im_global->calctime); } #else raysum_close (rs_global); strncpy (im_global->remark, remark, MAXREMARK); - image_save (im_global); - time_end = td_current_sec(); im_global->calctime = time_end - time_start; + image_save (im_global); if (opt_verbose) fprintf (stdout, "Time active = %.2f secs\n", im_global->calctime); #endif -- 2.34.1