Uploaded image for project: 'Request For Comments'
  1. Request For Comments
  2. RFC-202

Builds are optimised by default

    XMLWordPrintable

    Details

    • Type: RFC
    • Status: Implemented
    • Resolution: Done
    • Component/s: DM
    • Labels:
      None

      Description

      By default, our builds are not optimised (-O0), which requires everyone who doesn't want to wait until the heat death of the universe to set SCONSFLAGS="opt=3", but other packages that are built with scons may not recognise this. This default is also contrary to the standard practise for open-source software, which is that by default builds are optimised. I propose to change the default optimisation level to opt=3 from the current opt=0. It's a very simple change in sconsUtils:

      --- a/python/lsst/sconsUtils/state.py
      +++ b/python/lsst/sconsUtils/state.py
      @@ -98,7 +98,7 @@ def _initVariables():
               SCons.Script.BoolVariable('force', 'Set to force possibly dangerous behaviours', False),
               ('optfile', 'Specify a file to read default options from', None),
               ('prefix', 'Specify the install destination', None),
      -        SCons.Script.EnumVariable('opt', 'Set the optimisation level', 0,
      +        SCons.Script.EnumVariable('opt', 'Set the optimisation level', 3,
                                         allowed_values=('0', '1', '2', '3')),
               SCons.Script.EnumVariable('profile', 'Compile/link for profiler', 0,
                                         allowed_values=('0', '1', 'pg', 'gcov')),
      

        Attachments

          Issue Links

            Activity

            Hide
            Parejkoj John Parejko added a comment - - edited

            Would it be worth using a lower optimization (e.g. 1 or 2) to make debugging feasible? I guess the tradeoff is general run time for everyone vs. people who want to use gdb having to rebuild lots of things without optimization.

            Show
            Parejkoj John Parejko added a comment - - edited Would it be worth using a lower optimization (e.g. 1 or 2) to make debugging feasible? I guess the tradeoff is general run time for everyone vs. people who want to use gdb having to rebuild lots of things without optimization.
            Hide
            price Paul Price added a comment -

            I don't think so. You either want optimisation on full (2 or 3) for production-style builds, or you want it off completely (0) for debugging builds. I don't think there's any helpful middle ground.

            Note also that even with optimisation turned off completely (-O0), debugging C++ in gdb can still be very difficult because it inlines stuff anyway.

            Show
            price Paul Price added a comment - I don't think so. You either want optimisation on full (2 or 3) for production-style builds, or you want it off completely (0) for debugging builds. I don't think there's any helpful middle ground. Note also that even with optimisation turned off completely ( -O0 ), debugging C++ in gdb can still be very difficult because it inlines stuff anyway.
            Hide
            fritzm Fritz Mueller added a comment -

            -Og (4.8 or later) is a good middle ground for debug?

            Show
            fritzm Fritz Mueller added a comment - -Og (4.8 or later) is a good middle ground for debug?
            Hide
            price Paul Price added a comment -

            Aside: I wasn't aware of -Og. I don't think we've currently got a means for setting it through sconsUtils (short of putting it in SCONSFLAGS). I'll fix that when I change the default optimisation setting.

            Show
            price Paul Price added a comment - Aside: I wasn't aware of -Og . I don't think we've currently got a means for setting it through sconsUtils (short of putting it in SCONSFLAGS ). I'll fix that when I change the default optimisation setting.
            Hide
            price Paul Price added a comment -

            It shall be done in DM-7010.

            Show
            price Paul Price added a comment - It shall be done in DM-7010 .

              People

              Assignee:
              price Paul Price
              Reporter:
              price Paul Price
              Watchers:
              Fritz Mueller, John Parejko, John Swinbank, Mario Juric, Paul Price, Russell Owen, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Planned End:

                  Jenkins Builds

                  No builds found.