- mpi_t1 = MPI::Wtime();
- proj_reconst (*im_local, rs_local, opt_filter, opt_filter_param,
- opt_interp, opt_interp_param, opt_backproj, opt_trace);
-
- mpi_t2 = MPI::Wtime();
- mpi_t = mpi_t2 - mpi_t1;
- mpiWorld.getComm().Reduce(&mpi_t, &mpi_t_g, 1, MPI::DOUBLE, MPI::MAX, 0);
- if (mpiWorld.getRank() == 0 && opt_verbose)
- printf("Time to reconstruct = %f, Max time = %f\n", mpi_t, mpi_t_g);
-#else
- proj_reconst (*im_global, rs_global, opt_filter, opt_filter_param,
- opt_interp, opt_interp_param, opt_backproj, opt_trace);
-#endif
-
-#ifdef HAVE_MPI
- if (opt_verbose)
- mpi_t1 = MPI::Wtime();
-
- int nxLocal = im_local->nx();
- int nyLocal = im_local->ny();
- ImageFileArray vLocal = im_local->getArray();
- ImageFileArray vGlobal = NULL;
- if (mpiWorld.getRank() == 0)
- vGlobal = im_global->getArray();
-
- for (int ix = 0; ix < nxLocal; ix++) {
- void *recvbuf = NULL;
- if (mpiWorld.getRank() == 0)
- recvbuf = vGlobal[ix];
-
- mpiWorld.getComm().Reduce(vLocal[ix], recvbuf, nyLocal, im_local->getMPIDataType(), MPI::SUM, 0);
- }
-
- if (opt_verbose) {
- mpi_t2 = MPI::Wtime();
- mpi_t = mpi_t2 - mpi_t1;
- mpiWorld.getComm().Reduce (&mpi_t, &mpi_t_g, 1, MPI::DOUBLE, MPI::MAX, 0);
- if (mpiWorld.getRank() == 0)
- printf("Time to reduce image = %f secs, max time = %f\n", mpi_t, mpi_t_g);
- }
-
- if (mpiWorld.getRank() == 0)
- time_end = MPI::Wtime();
+ TimerCollectiveMPI timerReconstruct (mpiWorld.getComm());
+ projLocal.reconstruct (*imLocal, optFilterName.c_str(), optFilterParam, optInterpName.c_str(), optInterpParam, optBackprojName.c_str(), optTrace);
+ if (optVerbose)
+ timerReconstruct.timerEndAndReport ("Time to reconstruct");
+
+ TimerCollectiveMPI timerReduce (mpiWorld.getComm());
+ ReduceImageMPI (mpiWorld, imLocal, imGlobal);
+ if (optVerbose)
+ timerReduce.timerEndAndReport ("Time to reduce image");