[BuildTools-tickets] [BuildTools] #80: configure for profiling

BuildTools coin-trac at coin-or.org
Thu Nov 25 10:29:52 EST 2010


#80: configure for profiling
------------------------+---------------------------------------------------
Reporter:  Gassmann     |        Owner:  somebody          
    Type:  enhancement  |       Status:  new               
Priority:  minor        |    Component:  Wiki documentation
 Version:  0.5          |   Resolution:                    
Keywords:               |  
------------------------+---------------------------------------------------

Comment (by stefan):

 Hi,

 I have no experience with profiling, but now tried with Ipopt 3.8.

 I first tried (in my config.site file) only
 {{{
 ADD_CFLAGS=-pg
 ADD_CXXFLAGS=-pg
 LDFLAGS=-pg
 }}}
 This did not work, because the compiler complained that --fomit-frame-
 pointer and -pg are not compatible.

 So let's also overwrite the OPT_CFLAGS, OPT_FFLAGS, and OPT_CXXFLAGS:
 {{{
 LDFLAGS=-pg

 OPT_FFLAGS="-O3"

 OPT_CFLAGS="-O3 -pipe -DNDEBUG"
 ADD_CFLAGS=-pg

 OPT_CXXFLAGS="-O3 -pipe -DNDEBUG"
 ADD_CXXFLAGS=-pg
 }}}
 This compiled and linked for me.

 Compiling in Ipopt/example/ScalableProblems and running one of the
 examples created a {{{gmon.out}}} file.

 Doing {{{gprof ./solve_problem}}} gives
 {{{
 Flat profile:

 Each sample counts as 0.01 seconds.
   %   cumulative   self              self     total
  time   seconds   seconds    calls  Ts/call  Ts/call  name
 100.00      0.01     0.01
 MittelmannBndryCntrlDiriBase::eval_g(int, double const*, bool, int,
 double*)
   0.00      0.01     0.00    10404     0.00     0.00
 MittelmannBndryCntrlDiri1::y_d_cont(double, double) const
   0.00      0.01     0.00       40     0.00     0.00
 RegisteredTNLPs::RegisterTNLP(Ipopt::SmartPtr<RegisteredTNLP> const&,
 std::string)
   0.00      0.01     0.00       40     0.00     0.00
 std::_Rb_tree<std::string, std::pair<std::string const,
 Ipopt::SmartPtr<RegisteredTNLP> >, std::_Select1st<std::pair<std::string
 const, Ipopt::SmartPtr<RegisteredTNLP> > >, std::less<std::string>,
 std::allocator<std::pair<std::string const,
 Ipopt::SmartPtr<RegisteredTNLP> > > >::_M_insert_(std::_Rb_tree_node_base
 const*, std::_Rb_tree_node_base const*, std::pair<std::string const,
 Ipopt::SmartPtr<RegisteredTNLP> > const&)
   0.00      0.01     0.00       40     0.00     0.00
 std::_Rb_tree<std::string, std::pair<std::string const,
 Ipopt::SmartPtr<RegisteredTNLP> >, std::_Select1st<std::pair<std::string
 const, Ipopt::SmartPtr<RegisteredTNLP> > >, std::less<std::string>,
 std::allocator<std::pair<std::string const,
 Ipopt::SmartPtr<RegisteredTNLP> > >
 >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<std::string
 const, Ipopt::SmartPtr<RegisteredTNLP> > >, std::pair<std::string const,
 Ipopt::SmartPtr<RegisteredTNLP> > const&)
   0.00      0.01     0.00       33     0.00     0.00
 RegisteredTNLPs::RegisteredTNLPs(Ipopt::SmartPtr<RegisteredTNLP> const&,
 std::string)
   0.00      0.01     0.00        8     0.00     0.00
 Ipopt::SmartPtr<RegisteredTNLP>::ReleasePointer_()
 }}}

 And I think this output says that most of the time is spend in the
 evaluation of the gradient.

 I do not get as much output from gprof as I expected.
 E.g., all function calls mentioned seem to be from the examples code, but
 nothing from the Ipopt library itself.

 Maybe a static build (--disable-shared) will do better?

 Also I saw that in the SCIP makefiles we have a -g in the compiler flags.
 This may yield more information in the gprof output about where a function
 is located in the code and so on.

 Using also {{{-lc_p}}} instead of {{{-lc}}} as mentioned at
 {{{http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC2}}} I have
 not tried. They say {{{This is not absolutely necessary, but doing this
 gives you number-of-calls information for standard library functions such
 as read and open.}}}
 Maybe adding -lc_p to LDFLAGS would suffice.

 Stefan

-- 
Ticket URL: <https://projects.coin-or.org/BuildTools/ticket/80#comment:1>
BuildTools <http://projects.coin-or.org/BuildTools>
Tools for configuring and compiling COIN-OR codes



More information about the BuildTools-tickets mailing list