<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    The suggestion of trying gprof is something that I'd been meaning to
    do in the past, and now there was an incentive.<br>
    I changed the subject line of this email to better reflect that this
    is now the topic.<br>
    <br>
    I haven't seen any instructions on using gprof for ADMB, so I posted
    the steps that eventually succeeded at <a
href="http://admb-project.org/community/tutorials-and-examples/how-to-use-gprof-the-gnu-profiler">http://admb-project.org/community/tutorials-and-examples/how-to-use-gprof-the-gnu-profiler</a>.
    If it turns out that these options were already built into the
    existing scripts or if there's an easier way, let me know so I can
    update the instructions on the web. (If the instructions are any
    good, then maybe they could be built upon by Hans, Johnoel, Jim I.
    and Ray Conser, <a
href="http://admb-project.org/community/admb-meeting-march-29-31/ADMBMeetingReportv3.pdf#page=4">who
      were assigned the lower priority topic of "code tuning"</a> at the
    past ADMB meeting).<br>
    <br>
    I haven't really digested the results yet, because there are a lot
    of differences between the profiles I got for ADMB versions 9 and
    10. However, here's a sample of the function calls that took up the
    most time, matched up with the times (in seconds) from version 9
    (compiled from the identical TPL file and identical inputs):<br>
    <br>
    <tt>v9.secs v10.secs function.name<br>
      2.62    14.8    
      dvector::save_dvector_derivatives(dvar_vector_position const&)
      const<br>
      5.72    9.43     DF_FILE::fread(double const&)<br>
      NA      9.1      dvector::operator()(int)<br>
      0.61    6.55     gradient_structure::jacobcalc(int,
      std::basic_ofstream<char, std::char_traits<char> >
      const&)<br>
      1.05    6.21    
      restore_dvar_vector_derivatives(dvar_vector_position const&)<br>
      0.52    5.59     gradcalc(int, dvector const&)<br>
      NA      5.08     dvector::elem(int)<br>
      1.66    4.33     DF_FILE::fwrite(double)<br>
      1.96    4.21     restore_dvar_vector_value(dvar_vector_position
      const&)<br>
      NA      3.86     dvar_vector_position::indexmin() const<br>
    </tt><br>
    These functions that are taking the most time seem to be deep in
    ADMB (or AUTODIF) and not stuff that's easy for a user to work
    around. If I'm not the only one finding version 10 to be slower than
    version 9, then I'm guessing that somebody else is better equipped
    to suggest what to do about it.<br>
    -Ian<br>
    <br>
    On 11/12/2010 6:53 AM, dave fournier wrote:
    <blockquote cite="mid:4CDD54D4.7080004@otter-rsch.com" type="cite">Ian
      Taylor wrote:
      <br>
      <br>
      You could compile it for profiling and find out where the time is
      spent
      <br>
      with gprof.
      <br>
      <blockquote type="cite">After sending the yesterday, I caught the
        missing -O3. I tried adding it back and also just doing the
        compiling with the old script. But as long as I used the new
        libraries at the adlink stage, it went slow. And by slow, I mean
        more than 8 minutes for a model that previously took 2 1/2
        minutes in ADMB version 9 if optimized and just over 3 minutes
        in safe mode (which also suggests that it's not just a matter of
        optimizing).
        <br>
        <br>
        I can try other models to see if the pattern I saw was
        consistent, but I'm also curious if anyone else has compared the
        speeds between versions. I don't know if this is in the
        documentation, but run times can be quantified with code like
        the following.
        <br>
        -Ian
        <br>
        <br>
            TOP_OF_MAIN_SECTION
        <br>
              time(&start);
        <br>
        <br>
            GLOBALS_SECTION
        <br>
              #include <time.h>
        <br>
              time_t start,finish;
        <br>
              double elapsed_time;
        <br>
        <br>
            FINAL_SECTION
        <br>
              time(&finish);
        <br>
              elapsed_time = difftime(finish,start);
        <br>
        <br>
        On 11/12/2010 2:09 PM, Johnoel Ancheta wrote:
        <br>
        <blockquote type="cite">Opps... Sorry...
          <br>
          <br>
          I accidentally committed the Makefile without the -O3 option.
          <br>
          <br>
          I'll correct and commit the changes.
          <br>
          <br>
          Thanks Dave for catching that.
          <br>
          <br>
          Johnoel
          <br>
          <br>
          On 11/12/10 4:09 AM, dave fournier wrote:
          <br>
          <blockquote type="cite">Ian Taylor wrote:
            <br>
            <br>
            Just a thought Re speed. I don't see a -O3 flag for gcc for
            optimization.
            <br>
            <blockquote type="cite">Hi Johnoel and others,
              <br>
              <br>
              Compiling ADMB 10 Beta on with 64-bit linux worked
              perfectly for me with the files in the download.
              <br>
              <br>
              However, the new script you sent by email failed. From the
              commands below (fuller notes attached), it looks like for
              Ubuntu at least, it would be better to test for 64 vs 32
              using uname -m rather than uname -p.
              <br>
              <br>
                  ~/admb/admb-10.0Beta $ uname -a
              <br>
                  Linux ian-laptop 2.6.32-25-generic #45-Ubuntu SMP Sat
              Oct 16
              <br>
                  19:52:42 UTC 2010 x86_64 GNU/Linux
              <br>
                  ~/admb/admb-10.0Beta $ uname -s
              <br>
                  Linux
              <br>
                  ~/admb/admb-10.0Beta $ uname -p
              <br>
                  unknown
              <br>
                  ~/admb/admb-10.0Beta $ uname -m
              <br>
                  x86_64
              <br>
              <br>
              Aside from the good news of the successful install, this
              version 10 Beta also produced identical results, which is
              also good news. However, it seems to be running slower
              than version 9, by a large margin, at least for a single
              model that I tried. Perhaps related to this, when I
              compiled using GCC in and ADMB version 9, the safe
              executable was about double the size of the optimized.
              Compiling with ADMB version 10, the file sizes are
              similar, and in between the old sizes. Perhaps the speed
              and file size differences are related to changes in the
              compile scripts? My old script was dated "23 May 2009".
              <br>
              <br>
              Finally, thank you, Johnoel, and all the others who've
              contributed to the developments that have gone into this
              new beta release.
              <br>
              -Ian
              <br>
              <br>
              On 11/10/2010 02:44 PM, Johnoel Ancheta wrote:
              <br>
              <blockquote type="cite">Updated configure script is
                available.
                <br>
                <br>
                <a class="moz-txt-link-freetext" href="http://admb-project.googlecode.com/files/configure">http://admb-project.googlecode.com/files/configure</a>
                <br>
                <br>
                Download and replace the configure script in the
                admb-10.0Beta distribution.
                <br>
                <br>
                <br>
                On 11/10/10 11:09 AM, Ben Bolker wrote:
                <br>
                <blockquote type="cite">   (running under VMWare Fusion
                  on Mac OS X.6, but I don't think that
                  <br>
                  matters)
                  <br>
                  <br>
                     It looks like configure is getting confused and
                  thinking my system is
                  <br>
                  64-bit ... ?
                  <br>
                  <br>
                  <blockquote type="cite">uname -a
                    <br>
                  </blockquote>
                  Linux ubuntu-10 2.6.32-25-generic #45-Ubuntu SMP Sat
                  Oct 16 19:48:22 UTC
                  <br>
                  2010 i686 GNU/Linux
                  <br>
                  <br>
                  uname -m
                  <br>
                  i686  ## indicates 32-bit kernel
                  <br>
                  <br>
                  $ gcc -v
                  <br>
                  Using built-in specs.
                  <br>
                  Target: i486-linux-gnu
                  <br>
                  Configured with: ../src/configure -v
                  --with-pkgversion='Ubuntu
                  <br>
                  4.4.3-4ubuntu5'
                  --with-bugurl=<a class="moz-txt-link-freetext" href="file:///usr/share/doc/gcc-4.4/README.Bugs">file:///usr/share/doc/gcc-4.4/README.Bugs</a>
                  <br>
                  --enable-languages=c,c++,fortran,objc,obj-c++
                  --prefix=/usr
                  <br>
                  --enable-shared --enable-multiarch
                  --enable-linker-build-id
                  <br>
                  --with-system-zlib --libexecdir=/usr/lib
                  --without-included-gettext
                  <br>
                  --enable-threads=posix
                  --with-gxx-include-dir=/usr/include/c++/4.4
                  <br>
                  --program-suffix=-4.4 --enable-nls
                  --enable-clocale=gnu
                  <br>
                  --enable-libstdcxx-debug --enable-plugin
                  --enable-objc-gc
                  <br>
                  --enable-targets=all --disable-werror
                  --with-arch-32=i486
                  <br>
                  --with-tune=generic --enable-checking=release
                  --build=i486-linux-gnu
                  <br>
                  --host=i486-linux-gnu --target=i486-linux-gnu
                  <br>
                  Thread model: posix
                  <br>
                  gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
                  <br>
                  <br>
                  <br>
                  <br>
                  <a class="moz-txt-link-abbreviated" href="mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$">bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$</a>
                  <a class="moz-txt-link-rfc2396E" href="mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$"><mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$></a>
                  <a class="moz-txt-link-rfc2396E" href="mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$"><mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$></a>
                  sudo ./configure
                  <br>
                  checking for gcc... gcc
                  <br>
                  checking whether the C compiler works... yes
                  <br>
                  checking for C compiler default output file name...
                  a.out
                  <br>
                  checking for suffix of executables...
                  <br>
                  checking whether we are cross compiling... no
                  <br>
                  checking for suffix of object files... o
                  <br>
                  checking whether we are using the GNU C compiler...
                  yes
                  <br>
                  checking whether gcc accepts -g... yes
                  <br>
                  checking for gcc option to accept ISO C89... none
                  needed
                  <br>
                  checking for g++... g++
                  <br>
                  checking whether we are using the GNU C++ compiler...
                  yes
                  <br>
                  checking whether g++ accepts -g... yes
                  <br>
                  checking how to run the C++ preprocessor... g++ -E
                  <br>
                  checking for grep that handles long lines and -e...
                  /bin/grep
                  <br>
                  checking for egrep... /bin/grep -E
                  <br>
                  checking for ANSI C header files... yes
                  <br>
                  checking for sys/types.h... yes
                  <br>
                  checking for sys/stat.h... yes
                  <br>
                  checking for stdlib.h... yes
                  <br>
                  checking for string.h... yes
                  <br>
                  checking for memory.h... yes
                  <br>
                  checking for strings.h... yes
                  <br>
                  checking for inttypes.h... yes
                  <br>
                  checking for stdint.h... yes
                  <br>
                  checking for unistd.h... yes
                  <br>
                  checking iostream usability... yes
                  <br>
                  checking iostream presence... yes
                  <br>
                  checking for iostream... yes
                  <br>
                  checking for flex... flex
                  <br>
                  checking lex output file root... lex.yy
                  <br>
                  checking lex library... none needed
                  <br>
                  checking whether yytext is a pointer... no
                  <br>
                  checking for sed... yes
                  <br>
                  checking whether C++ compiler is 64-bit enabled... yes
                  <br>
                  checking for svnversion... yes
                  <br>
                  configure: creating ./config.status
                  <br>
                  config.status: creating GNUmakefile
                  <br>
                  config.status: creating admb_configure.h
                  <br>
                  config.status: creating scripts/bash/admb-bin
                  <br>
                  <br>
                  Configure completed for
                  admb10.0Beta-linux-gcc4.4.3-64bit
                  <br>
                  To build ADMB, type 'make'
                  <br>
                  <a class="moz-txt-link-abbreviated" href="mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$">bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$</a>
                  <a class="moz-txt-link-rfc2396E" href="mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$"><mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$></a>
                  <a class="moz-txt-link-rfc2396E" href="mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$"><mailto:bolker@ubuntu-10:/usr/local/src/admb-10.0Beta$></a>
                  sudo make
                  <br>
                  CXX=g++ CXXFLAGS="-m64"
                  <br>
LIBPATH=../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects
                  <br>
                  DISK=../build/admb10.0Beta-linux-gcc4.4.3-64bit/dist
                  ADMB_CONFIGURE=1
                  <br>
                  make --directory=src --file=linux.mak
                  <br>
                  make[1]: Entering directory
                  `/usr/local/src/admb-10.0Beta/src'
                  <br>
                  rm -rf ../build/admb10.0Beta-linux-gcc4.4.3-64bit/dist
                  <br>
                  mkdir -p
                  <br>
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/dist/{bin,lib,include,docs,docs/manuals,examples}
                  <br>
                  mkdir -p
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/linad99-olp
                  <br>
                  mkdir -p
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/linad99-slp
                  <br>
                  mkdir -p
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/nh99-olp
                  <br>
                  mkdir -p
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/nh99-olp-stub
                  <br>
                  mkdir -p
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/tools99-olp
                  <br>
                  mkdir -p
                  <br>
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/df1b2-separable-slp
                  <br>
                  mkdir -p
                  <br>
                  ../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/df1b2-separable-olp
                  <br>
                  make --directory=df1b2-separable CC=gcc CXXFLAGS="-c
                  -m64 -Wall
                  <br>
                  -Wno-deprecated -DUSE_LAPLACE -fpermissive
                  -I../df1b2-separable
                  <br>
                  -I../nh99 -I../linad99 -I../tools99 -D__SPDLL__
                  -D__GNUDOS__ -Dlinux
                  <br>
                  -DOPT_LIB"
                  <br>
                  LIBPATH=../../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/df1b2-separable-olp
                  <br>
                  DISKDIR=../../build/admb10.0Beta-linux-gcc4.4.3-64bit/dist
                  -f
                  <br>
                  optg32-rh8-laplace.mak disk
                  <br>
                  make[2]: Entering directory
                  <br>
                  `/usr/local/src/admb-10.0Beta/src/df1b2-separable'
                  <br>
                  g++ -c -m64 -Wall -Wno-deprecated -DUSE_LAPLACE
                  -fpermissive
                  <br>
                  -I../df1b2-separable -I../nh99 -I../linad99
                  -I../tools99 -D__SPDLL__
                  <br>
                  -D__GNUDOS__ -Dlinux -DOPT_LIB  df1b2impspf.cpp -o
                  <br>
                  ../../build/admb10.0Beta-linux-gcc4.4.3-64bit/objects/df1b2-separable-olp/df1b2impspf.obj
                  <br>
                  In file included from /usr/include/features.h:378,
                  <br>
                                    from /usr/include/unistd.h:26,
                  <br>
                                    from ../linad99/fvar.hpp:173,
                  <br>
                                    from ../nh99/admodel.h:69,
                  <br>
                                    from df1b2impspf.cpp:8:
                  <br>
                  /usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h:
                  No such file or
                  <br>
                  directory
                  <br>
                  df1b2impspf.cpp: In function ‘double
                  <br>
                  calculate_importance_sample_shess(const dvector&,
                  const dvector&, const
                  <br>
                  dmatrix&, const dvector&, const dvector&,
                  const dmatrix&,
                  <br>
                  function_minimizer*)’:
                  <br>
                  df1b2impspf.cpp:20: warning: unused variable
                  ‘Hessadjoint’
                  <br>
                  df1b2impspf.cpp:44: warning: unused variable ‘onvar’
                  <br>
                  df1b2impspf.cpp:49: warning: unused variable ‘j’
                  <br>
                  make[2]: *** [df1b2impspf.obj] Error 1
                  <br>
                  make[2]: Leaving directory
                  <br>
                  `/usr/local/src/admb-10.0Beta/src/df1b2-separable'
                  <br>
                  make[1]: *** [dist] Error 2
                  <br>
                  make[1]: Leaving directory
                  `/usr/local/src/admb-10.0Beta/src'
                  <br>
                  make: *** [all] Error 2
                  <br>
                  _______________________________________________
                  <br>
                  Developers mailing list
                  <br>
                  <a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a>
                  <a class="moz-txt-link-rfc2396E" href="mailto:Developers@admb-project.org"><mailto:Developers@admb-project.org></a>
                  <a class="moz-txt-link-rfc2396E" href="mailto:Developers@admb-project.org"><mailto:Developers@admb-project.org></a>
                  <br>
<a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a>
                  <br>
                </blockquote>
                <br>
                _______________________________________________
                <br>
                Developers mailing list
                <br>
                <a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a>
                <a class="moz-txt-link-rfc2396E" href="mailto:Developers@admb-project.org"><mailto:Developers@admb-project.org></a>
                <a class="moz-txt-link-rfc2396E" href="mailto:Developers@admb-project.org"><mailto:Developers@admb-project.org></a>
                <br>
<a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a>
                <br>
              </blockquote>
              ------------------------------------------------------------------------
              <br>
              <br>
              _______________________________________________
              <br>
              Developers mailing list
              <br>
              <a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a>
              <a class="moz-txt-link-rfc2396E" href="mailto:Developers@admb-project.org"><mailto:Developers@admb-project.org></a>
              <br>
              <a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a>
              <br>
            </blockquote>
            <br>
          </blockquote>
          <br>
        </blockquote>
      </blockquote>
      <br>
    </blockquote>
  </body>
</html>