Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-24162

Look into setting NUMEXPR_MAX_THREADS

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Invalid
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: utils
    • Labels:
      None

      Description

      Pandas started giving me this warning:

      (Pdb) type(res)
      <class 'pandas.core.series.Series'>
      (Pdb) res *= 1
      numexpr.utils INFO: Note: NumExpr detected 24 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
      numexpr.utils INFO: NumExpr defaulting to 8 threads.
      

      This is going to get annoying. Seen in transformObjectCatalogTask. Let's do something intentional.

        Attachments

          Issue Links

            Activity

            Hide
            lauren Lauren MacArthur added a comment -

            I’m also now seeing this in the `pipe_analysis` scripts as I move to using pandas dataframes, +1 from me!

            Show
            lauren Lauren MacArthur added a comment - I’m also now seeing this in the `pipe_analysis` scripts as I move to using pandas dataframes, +1 from me!
            Hide
            jbosch Jim Bosch added a comment -

            Right place to do this looks like https://github.com/lsst/base/blob/master/src/threads.cc#L132, which already covers OMP_NUM_THREADS (and a few others), but not NUMEXPR_MAX_THREADS.

            I have no idea why that's implemented in C++ rather than Python, but it's already being called by both CmdLineTask and pipetask when -j N is used with N > 1. And where there might be other contexts where we want to disable implicit threading, they should probably do it by calling lsst.base.disableImplicitThreading(), too.

            Show
            jbosch Jim Bosch added a comment - Right place to do this looks like https://github.com/lsst/base/blob/master/src/threads.cc#L132 , which already covers OMP_NUM_THREADS (and a few others), but not NUMEXPR_MAX_THREADS. I have no idea why that's implemented in C++ rather than Python, but it's already being called by both CmdLineTask and pipetask when -j N is used with N > 1 . And where there might be other contexts where we want to disable implicit threading, they should probably do it by calling lsst.base.disableImplicitThreading() , too.
            Hide
            tjenness Tim Jenness added a comment -

            import pandas is enough to trigger the warning now.

            Show
            tjenness Tim Jenness added a comment - import pandas is enough to trigger the warning now.
            Hide
            tjenness Tim Jenness added a comment -

            This was fixed in DM-33622.

            Show
            tjenness Tim Jenness added a comment - This was fixed in DM-33622 .
            Hide
            tjenness Tim Jenness added a comment -

            By fixed I mean that you do need to use lsst.utils.threads.disable_implicit_threading. There is no way to stop the log message appearing if you have globally enabled INFO log level because this triggers as soon as pandas is imported – you would need to call disable_implicit_threading before all other imports or set the NUMEXPR envvar in your shell.

            We no longer set the python root logger to INFO so you will no longer see the log message by default.

            Show
            tjenness Tim Jenness added a comment - By fixed I mean that you do need to use lsst.utils.threads.disable_implicit_threading . There is no way to stop the log message appearing if you have globally enabled INFO log level because this triggers as soon as pandas is imported – you would need to call disable_implicit_threading before all other imports or set the NUMEXPR envvar in your shell. We no longer set the python root logger to INFO so you will no longer see the log message by default.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              yusra Yusra AlSayyad
              Watchers:
              Bryce Kalmbach, Jim Bosch, Krzysztof Suberlak, Lauren MacArthur, Tim Jenness, Yusra AlSayyad
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.