Changeset 523


Ignore:
Timestamp:
Sep 20, 2005 2:02:12 PM (14 years ago)
Author:
andreasw
Message:

added TiminigStatistics? for measuring CPU time usage in different parts of
the algorithm. This might not yet compile on all platforms!

Location:
branches/dev/Algorithm
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/dev/Algorithm/IpFilterLineSearch.cpp

    r520 r523  
    12891289    }
    12901290
     1291    IpData().TimingStats().TryCorrector.Start();
     1292
    12911293    bool accept = false;
    12921294
     
    14391441      Jnlst().Printf(J_DETAILED, J_LINE_SEARCH,
    14401442                     "Rejecting corrector step, because trial complementarity is too large.\n" );
     1443      IpData().TimingStats().TryCorrector.End();
    14411444      return false;
    14421445    }
     
    14711474    }
    14721475
     1476    IpData().TimingStats().TryCorrector.End();
    14731477    return accept;
    14741478  }
  • branches/dev/Algorithm/IpIpoptAlg.cpp

    r514 r523  
    144144    DBG_START_METH("IpoptAlgorithm::Optimize", dbg_verbosity);
    145145
     146    // Start measuring CPU time
     147    IpData().TimingStats().OverallAlgorithm.Start();
     148
    146149    if (!message_printed) {
    147150      print_message(Jnlst());
     
    188191      OutputIteration();
    189192
     193      IpData().TimingStats().OverallAlgorithm.End();
     194
    190195      if (conv_status == ConvergenceCheck::CONVERGED) {
    191196        return SUCCESS;
     
    200205    catch(TINY_STEP_DETECTED& exc) {
    201206      exc.ReportException(Jnlst(), J_DETAILED);
     207      IpData().TimingStats().OverallAlgorithm.End();
    202208      return STOP_AT_TINY_STEP;
    203209    }
    204210    catch(ACCEPTABLE_POINT_REACHED& exc) {
    205211      exc.ReportException(Jnlst(), J_DETAILED);
     212      IpData().TimingStats().OverallAlgorithm.End();
    206213      return STOP_AT_ACCEPTABLE_POINT;
    207214    }
    208215    catch(LOCALLY_INFEASIBLE& exc) {
    209216      exc.ReportException(Jnlst(), J_DETAILED);
     217      IpData().TimingStats().OverallAlgorithm.End();
    210218      return LOCAL_INFEASIBILITY;
    211219    }
    212220    catch(RESTORATION_FAILED& exc) {
    213221      exc.ReportException(Jnlst(), J_DETAILED);
     222      IpData().TimingStats().OverallAlgorithm.End();
    214223      return RESTORATION_FAILURE;
    215224    }
    216225    catch(FEASIBILITY_PROBLEM_SOLVED& exc) {
    217226      exc.ReportException(Jnlst(), J_DETAILED);
     227      IpData().TimingStats().OverallAlgorithm.End();
    218228      return SUCCESS;
    219229    }
    220230    catch(INTERNAL_ABORT& exc) {
    221231      exc.ReportException(Jnlst());
     232      IpData().TimingStats().OverallAlgorithm.End();
    222233      return INTERNAL_ERROR;
    223234    }
     
    225236    DBG_ASSERT(false && "Unknown return code in the algorithm");
    226237
     238    IpData().TimingStats().OverallAlgorithm.End();
    227239    return INTERNAL_ERROR;
    228240  }
  • branches/dev/Algorithm/IpIpoptData.hpp

    r520 r523  
    1414#include "IpIteratesVector.hpp"
    1515#include "IpRegOptions.hpp"
     16#include "IpTimingStatistics.hpp"
    1617
    1718namespace Ipopt
     
    362363    }
    363364    //@}
     365
     366    /** Return Timing Statistics Object */
     367    TimingStatistics& TimingStats()
     368    {
     369      return timing_statistics_;
     370    }
    364371
    365372    /** Methods for IpoptType */
     
    468475    SmartPtr<IteratesVectorSpace> iterates_space_;
    469476
     477    /** TimingStatistics object collecting all Ipopt timing
     478     *  statistics */
     479    TimingStatistics timing_statistics_;
     480
    470481    /**@name Default Compiler Generated Methods
    471482     * (Hidden to avoid implicit creation/calling).
  • branches/dev/Algorithm/IpPDFullSpaceSolver.cpp

    r522 r523  
    110110    DBG_START_METH("PDFullSpaceSolver::Solve",dbg_verbosity);
    111111
     112    // Timing of PDSystem solver starts here
     113    IpData().TimingStats().PDSystemSolver.Start();
     114
    112115    DBG_PRINT_VECTOR(2, "rhs_x", *rhs.x());
    113116    DBG_PRINT_VECTOR(2, "rhs_s", *rhs.s());
     
    178181        // might want to use a more explicit cue later.
    179182        res.Set(0.0);
     183        IpData().TimingStats().PDSystemSolver.End();
    180184        return;
    181185      }
     
    308312    DBG_PRINT_VECTOR(2, "res_vU", *res.v_U());
    309313
     314    IpData().TimingStats().PDSystemSolver.End();
    310315  }
    311316
  • branches/dev/Algorithm/IpQualityFunctionMuOracle.cpp

    r501 r523  
    222222
    223223    DBG_PRINT_VECTOR(2, "step_cen", *step_cen);
     224
     225    // Start the timing for the quality function search here
     226    IpData().TimingStats().QualityFunctionSearch.Start();
    224227
    225228    // We now compute the step for the slack variables.  This safes
     
    398401    }
    399402
     403    // End timing of quality function search
     404    IpData().TimingStats().QualityFunctionSearch.End();
     405
    400406    Jnlst().Printf(J_DETAILED, J_BARRIER_UPDATE,
    401407                   "Sigma = %e\n", sigma);
  • branches/dev/Algorithm/LinearSolvers/IpMa27TSolverInterface.cpp

    r517 r523  
    251251    DBG_START_METH("Ma27TSolverInterface::SymbolicFactorization",dbg_verbosity);
    252252
     253    IpData().TimingStats().LinearSystemSymbolicFactorization.Start();
     254
    253255    // Get memory for the IW workspace
    254256    delete [] iw_;
     
    306308    a_ = new double[la_];
    307309
     310    IpData().TimingStats().LinearSystemSymbolicFactorization.End();
     311
    308312    return SYMSOLVER_SUCCESS;
    309313  }
     
    317321    DBG_START_METH("Ma27TSolverInterface::Factorization",dbg_verbosity);
    318322    // Check if la should be increased
     323    IpData().TimingStats().LinearSystemFactorization.Start();
    319324    if (la_increase_) {
    320325      double* a_old = a_;
     
    392397                     "MA27BD returned iflag=%d.\n Increase liw from %d to %d and la from %d to %d and factorize again.\n",
    393398                     iflag, liw_old, liw_, la_old, la_);
     399      IpData().TimingStats().LinearSystemFactorization.End();
    394400      return SYMSOLVER_CALL_AGAIN;
    395401    }
     
    397403    // Check if the system is singular, and if some other error occurred
    398404    if (iflag==-5 || iflag==3) {
     405      IpData().TimingStats().LinearSystemFactorization.End();
    399406      return SYMSOLVER_SINGULAR;
    400407    }
    401408    else if (iflag != 0) {
    402409      // There is some error
     410      IpData().TimingStats().LinearSystemFactorization.End();
    403411      return SYMSOLVER_FATAL_ERROR;
    404412    }
     
    425433                     "In Ma27TSolverInterface::Factorization: negevals_ = %d, but numberOfNegEVals = %d\n",
    426434                     negevals_, numberOfNegEVals);
     435      IpData().TimingStats().LinearSystemFactorization.End();
    427436      return SYMSOLVER_WRONG_INERTIA;
    428437    }
    429438
     439    IpData().TimingStats().LinearSystemFactorization.End();
    430440    return SYMSOLVER_SUCCESS;
    431441  }
  • branches/dev/Algorithm/LinearSolvers/IpTSymLinearSolver.cpp

    r517 r523  
    104104    bool retval = true;
    105105    if (IsValid(scaling_method_)) {
     106      IpData().TimingStats().LinearSystemScaling.Start();
    106107      retval = scaling_method_->Initialize(Jnlst(), IpNLP(), IpData(), IpCq(),
    107108                                           options, prefix);
     109      IpData().TimingStats().LinearSystemScaling.End();
    108110    }
    109111    return retval;
     
    152154                                          &rhs_vals[irhs*(dim_)]);
    153155      if (IsValid(scaling_method_)) {
     156        IpData().TimingStats().LinearSystemScaling.Start();
    154157        for (Index i=0; i<dim_; i++) {
    155158          rhs_vals[irhs*(dim_)+i] *= scaling_factors_[i];
    156159        }
     160        IpData().TimingStats().LinearSystemScaling.End();
    157161      }
    158162    }
     
    194198      for (Index irhs=0; irhs<nrhs; irhs++) {
    195199        if (IsValid(scaling_method_)) {
     200          IpData().TimingStats().LinearSystemScaling.Start();
    196201          for (Index i=0; i<dim_; i++) {
    197202            rhs_vals[irhs*(dim_)+i] *= scaling_factors_[i];
    198203          }
     204          IpData().TimingStats().LinearSystemScaling.End();
    199205        }
    200206        TripletHelper::PutValuesInVector(dim_, &rhs_vals[irhs*(dim_)],
     
    260266      delete [] scaling_factors_;
    261267      if (IsValid(scaling_method_)) {
     268        IpData().TimingStats().LinearSystemScaling.Start();
    262269        scaling_factors_ = new double[dim_];
     270        IpData().TimingStats().LinearSystemScaling.End();
    263271      }
    264272
     
    334342
    335343    if (IsValid(scaling_method_)) {
     344      IpData().TimingStats().LinearSystemScaling.Start();
    336345      DBG_ASSERT(scaling_factors_);
    337346      if (new_matrix) {
     
    362371        }
    363372      }
     373      IpData().TimingStats().LinearSystemScaling.End();
    364374    }
    365375
  • branches/dev/Algorithm/Makefile.am

    r460 r523  
    5656        IpRestoRestoPhase.cpp IpRestoRestoPhase.hpp \
    5757        IpStdAugSystemSolver.cpp IpStdAugSystemSolver.hpp \
     58        IpTimingStatistics.cpp IpTimingStatistics.hpp \
    5859        IpUserScaling.cpp IpUserScaling.hpp \
    5960        IpWarmStartIterateInitializer.cpp IpWarmStartIterateInitializer.hpp
     
    110111        IpRestoRestoPhase.cppbak IpRestoRestoPhase.hppbak \
    111112        IpStdAugSystemSolver.cppbak IpStdAugSystemSolver.hppbak \
     113        IpTimingStatistics.cppbak IpTimingStatistics.hppbak \
    112114        IpUserScaling.cppbak IpUserScaling.hppbak \
    113115        IpWarmStartIterateInitializer.cppbak IpWarmStartIterateInitializer.hppbak
  • branches/dev/Algorithm/Makefile.in

    r465 r523  
    7373        IpRestoIterationOutput.$(OBJEXT) IpRestoMinC_1Nrm.$(OBJEXT) \
    7474        IpRestoRestoPhase.$(OBJEXT) IpStdAugSystemSolver.$(OBJEXT) \
    75         IpUserScaling.$(OBJEXT) \
     75        IpTimingStatistics.$(OBJEXT) IpUserScaling.$(OBJEXT) \
    7676        IpWarmStartIterateInitializer.$(OBJEXT)
    7777libipoptalg_a_OBJECTS = $(am_libipoptalg_a_OBJECTS)
     
    277277        IpRestoRestoPhase.cpp IpRestoRestoPhase.hpp \
    278278        IpStdAugSystemSolver.cpp IpStdAugSystemSolver.hpp \
     279        IpTimingStatistics.cpp IpTimingStatistics.hpp \
    279280        IpUserScaling.cpp IpUserScaling.hpp \
    280281        IpWarmStartIterateInitializer.cpp IpWarmStartIterateInitializer.hpp
     
    325326        IpRestoRestoPhase.cppbak IpRestoRestoPhase.hppbak \
    326327        IpStdAugSystemSolver.cppbak IpStdAugSystemSolver.hppbak \
     328        IpTimingStatistics.cppbak IpTimingStatistics.hppbak \
    327329        IpUserScaling.cppbak IpUserScaling.hppbak \
    328330        IpWarmStartIterateInitializer.cppbak IpWarmStartIterateInitializer.hppbak
     
    407409@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpRestoRestoPhase.Po@am__quote@
    408410@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpStdAugSystemSolver.Po@am__quote@
     411@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpTimingStatistics.Po@am__quote@
    409412@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpUserScaling.Po@am__quote@
    410413@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IpWarmStartIterateInitializer.Po@am__quote@
Note: See TracChangeset for help on using the changeset viewer.