subroutine init_TOTALstats c ***----------------------------------------------------------*** c * 'init_TOTALstats' sets all variables in the TOTALstats * c * common block to zero. * c ***----------------------------------------------------------*** real total_time common /TOTALstats/ total_time c total_time = 0. return end c subroutine update_TOTALstats (call_type) c integer call_type c ***----------------------------------------------------------*** c * 'update_TOTALstats' updates the total accumulated time * c * for the call to MirkDC. 'call_type' is used to start * c * the timer or stop the timer and record the time. * c * * c * call_type = 0 => start the timer * c * call_type = 1 => stop timer and record the time * c * * c * 'update_TOTALstats' is called explicitly only twice: * c * immediately before and after the only call to MirkDC. * c * Note that `total_time' is properly maintained by the * c * LA or non-(LA) statistics packages whenever a program * c * segment is timed. Upon termination, `total_time' is * c * the TRUE total time; it includes both the accumulated * c * time of all program segments monitored by the LA and * c * non-(LA) statistics packages, as well as the accumulated * c * time of all other program segments (including the time * c * for the statistics routines, but this is negligible.) * c ***----------------------------------------------------------*** real total_time common /TOTALstats/ total_time c real elapsed_time, tarray(2), dtime c if (call_type .eq. 0) then c ***----------------------------------------------------------*** c * Start the timer. * c ***----------------------------------------------------------*** elapsed_time = dtime(tarray) return else c ***----------------------------------------------------------*** c * Stop the timer and record statistics. * c ***----------------------------------------------------------*** elapsed_time = dtime(tarray) total_time = total_time + elapsed_time end if return end c subroutine display_TOTALstats (call_type, method, tol, Nsub, * epsilon, lft, rgt, nprocs, LAselCriteria, * nGraph, mxnGraph, nGraphFields, graphData) c integer call_type, method, Nsub, nprocs, LAselCriteria, * nGraph, mxnGraph, nGraphFields double precision tol, epsilon, lft, rgt real graphData(mxnGraph,nGraphFields) c ***----------------------------------------------------------*** c * 'display_TOTALstats' either * c * * c * call_type = 0 => outputs a summary for the current run * c * of accumulated timing statistics extracted from data * c * collected in the nonLAstats, LAstats, and TOTALstats * c * common blocks, and stores data for the current run * c * in compressed format in the `graphData' array, or * c * * c * call_type = 1 => outputs the `graphData' array; the data * c * in this array is later graphed using Matlab software. * c ***----------------------------------------------------------*** integer resid_count, defect_count, newmat_count real resid_time, defect_time, newmat_time common /nonLAstats/ resid_time, defect_time, newmat_time, * resid_count, defect_count, newmat_count c integer mx_num_mesh, mx_num_fails parameter (mx_num_mesh = 25, mx_num_fails = 10) real counts(mx_num_mesh,5) integer fails(mx_num_mesh,mx_num_fails) common /LAstats/ counts, fails c real total_time common /TOTALstats/ total_time c integer j, k, nint, mesh_size, num_facts, num_solves, * total_facts, total_solves real avgTime_resid, avgTime_defect, avgTime_newmat, * time_per_solve, fact_time, solve_time, * total_fact_time, total_solve_time, float, * avgTime_solve, avgTime_fact, time_not_monitored c if (call_type .eq. 0) then c ***----------------------------------------------------------*** c * Extract statistics from nonLAstats common block. * c ***----------------------------------------------------------*** avgTime_resid = resid_time/resid_count if (defect_count .gt. 0) then avgTime_defect = defect_time/defect_count else avgTime_defect = 0. end if avgTime_newmat = newmat_time/newmat_count c ***----------------------------------------------------------*** c * Extract statistics from LAstats common block. * c ***----------------------------------------------------------*** total_facts = 0 total_fact_time = 0. total_solves = 0 total_solve_time = 0. do 10 k = 1, mx_num_mesh if (counts(k,1) .eq. 0.) go to 20 c ***----------------------------------------------------------*** c * Accumulate totals from counts array. * c ***----------------------------------------------------------*** mesh_size = nint(counts(k,1)) num_facts = nint(counts(k,2)) num_solves = nint(counts(k,4) + counts(k,2)) time_per_solve = counts(k,5)/counts(k,4) fact_time = counts(k,3) - num_facts*time_per_solve solve_time = counts(k,5) + num_facts*time_per_solve total_facts = total_facts + num_facts total_fact_time = total_fact_time + fact_time total_solves = total_solves + num_solves total_solve_time = total_solve_time + solve_time 10 continue 20 avgTime_solve = total_solve_time/total_solves avgTime_fact = total_fact_time/total_facts c ***----------------------------------------------------------*** c * Calculate total time not monitored. * c ***----------------------------------------------------------*** time_not_monitored = total_time - * (resid_time + defect_time + newmat_time + * total_fact_time + total_solve_time) c ***----------------------------------------------------------*** c * Output statistics summary for this run. * c ***----------------------------------------------------------*** write(6,9997) write(6,9999) ' resid ', * resid_count, resid_time, avgTime_resid write(6,9999) ' defect_estimate ', * defect_count, defect_time, avgTime_defect write(6,9999) ' newmat ', * newmat_count, newmat_time, avgTime_newmat write(6,9999) ' factorization ', * total_facts, total_fact_time, avgTime_fact write(6,9999) ' solve ', * total_solves, total_solve_time, avgTime_solve write(6,9996) ' [not monitored] ', time_not_monitored write(6,9994) total_time c ***----------------------------------------------------------*** c * Store data for this run in the `graphData' array. * c ***----------------------------------------------------------*** nGraph = nGraph + 1 graphData(nGraph,1) = float(method) graphData(nGraph,2) = float(tol) graphData(nGraph,3) = float(Nsub) graphData(nGraph,4) = float(epsilon) graphData(nGraph,5) = float(lft) graphData(nGraph,6) = float(rgt) graphData(nGraph,7) = float(nprocs) graphData(nGraph,8) = float(LAselCriteria) graphData(nGraph,9) = float(resid_count) graphData(nGraph,10) = float(defect_count) graphData(nGraph,11) = float(newmat_count) graphData(nGraph,12) = float(total_facts) graphData(nGraph,13) = float(total_solves) graphData(nGraph,14) = resid_time graphData(nGraph,15) = defect_time graphData(nGraph,16) = newmat_time graphData(nGraph,17) = total_fact_time graphData(nGraph,18) = total_solve_time graphData(nGraph,19) = time_not_monitored graphData(nGraph,20) = total_time else c ***----------------------------------------------------------*** c * Print out the final `graphData' array. * c ***----------------------------------------------------------*** write(6,9992) nGraph do 40 j = 1, nGraph write(6,9991) nint(graphData(j,1)), graphData(j,2), * nint(graphData(j,3)), (graphData(j,k),k=4,6), * (nint(graphData(j,k)),k=7,13), * (graphData(j,k),k=14,nGraphFields) 40 continue end if return 9999 format (1x, a17, 1x, i4, 4x, e9.2, 4x, e9.2) 9997 format (/1x, ' SUMMARY and OVERALL STATISTICS: ' * /2x, 50('-') /3x, ' PRG_SEGMENT', 2x, ' #CALLs', * 2x, ' ACCUM_TIME', 2x, 'AV_TIME/CALL' /2x, 50('-')) 9996 format (1x, a17, 3x, '--', 4x, e9.2, 7x, '--') 9994 format (2x, 50('-') /4x, ' OVERALL MirkDC TIME: ', * f6.2, ' secs.') 9992 format (/1x, 'THERE WERE A TOTAL OF ', i2, ' RUNS. ', * ' FOR EACH RUN, THE FOLLOWING TABLE LISTS', * /2x, 'method, defect_tol, nsub_0, epsilon, lft, rgt,', * ' nprocs, L/A_ctl,', /2x, 'resid_count, defect_count,', * ' newmat_count, total_facts, total_solves,', * /2x, 'resid_time, defect_time, newmat_time,', * ' total_fact_time, total_solve_time,', * /2x, 'time_not_monitored, AND overall_MirkDC_time.'/) 9991 format (1x, i4, 1x, e9.2, 1x, i5, 3(1x, e9.2), 2(1x, i2), * 5(1x, i4), 7(1x, e12.5)) end