Skip to content

Teuchos: use provided stream formatting flags in TimeMonitor summarize()

James Willenbring requested to merge aprokop:teuchos_timers into develop

Created by: aprokop

@trilinos/teuchos @bartlettroscoe

This allows the user to control the formatting of the timer columns. The cost is storing an extra std::ios_base::fmtflags in TableEntry.

The original output may look like this:

MueLu: CoalesceDropFactory_kokkos: Build (total)                                                6.066 (4)                  
MueLu: CoalesceDropFactory_kokkos: Build (total, level=0)                                       4.69 (1)                   
MueLu: CoalesceDropFactory_kokkos: Build (total, level=1)                                       1.276 (1)                  
MueLu: CoalesceDropFactory_kokkos: Build (total, level=2)                                       0.0962 (1)                 
MueLu: CoalesceDropFactory_kokkos: Build (total, level=3)                                       0.003703 (1)               
MueLu: CoarseMapFactory_kokkos: Build                                                           0.0007512 (4)              
MueLu: CoarseMapFactory_kokkos: Build (level=0)                                                 0.0005596 (1)              
---------------------------------------------------------------------------------------------------------------------------
MueLu: CoarseMapFactory_kokkos: Build (level=1)                                                 4.289e-05 (1)              
MueLu: CoarseMapFactory_kokkos: Build (level=2)                                                 4.606e-05 (1)              
MueLu: CoarseMapFactory_kokkos: Build (level=3)                                                 3.998e-05 (1)              
MueLu: CoarseMapFactory_kokkos: Build (total)                                                   0.0007804 (4)              
MueLu: CoarseMapFactory_kokkos: Build (total, level=0)                                          0.000583 (1)               
MueLu: CoarseMapFactory_kokkos: Build (total, level=1)                                          5.083e-05 (1)              
MueLu: CoarseMapFactory_kokkos: Build (total, level=2)                                          5.396e-05 (1)              
MueLu: CoarseMapFactory_kokkos: Build (total, level=3)                                          4.722e-05 (1)

which is a mix of scientific and non-scientific notations with different precisions. The new output (when controlled with std::fixed or std::scientific before TimeMonitor::report) will look like this:

Driver: 5 - Belos Solve                                                                  3.1061 (1)
Driver: S - Global Time                                                                  7.2109 (1)
Ifpack2::Chebyshev::apply                                                                1.4155 (96)
Ifpack2::Chebyshev::compute                                                              0.3570 (3)
--------------------------------------------------------------------------------------------------------------------
MueLu: AggregationPhase1Algorithm: BuildAggregates (total)                               0.0687 (3)
MueLu: AggregationPhase2aAlgorithm: BuildAggregates (total)                              0.0266 (3)
MueLu: AggregationPhase2bAlgorithm: BuildAggregates (total)                              0.0454 (3)
MueLu: AggregationPhase3Algorithm: BuildAggregates (total)                               0.0010 (3)
MueLu: AmalgamationFactory: Build                                                        0.0001 (3)

or this

Driver: 1 - Matrix Build                                                                 5.7187e+00 (1)
Driver: 2 - MueLu Setup                                                                  9.0275e+00 (1)
Driver: 3 - LHS and RHS initialization                                                   8.5122e-03 (1)
Driver: 5 - Belos Solve                                                                  9.9469e+00 (1)
Driver: S - Global Time                                                                  2.4731e+01 (1)
Ifpack2::Chebyshev::apply                                                                4.5091e+00 (96)
Ifpack2::Chebyshev::compute                                                              1.1264e+00 (3)
--------------------------------------------------------------------------------------------------------------------
MueLu: AggregationPhase1Algorithm: BuildAggregates (total)                               2.3058e-01 (3)
MueLu: AggregationPhase2aAlgorithm: BuildAggregates (total)                              9.2283e-02 (3)
MueLu: AggregationPhase2bAlgorithm: BuildAggregates (total)                              1.5934e-01 (3)

Merge request reports