Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10656

TTreeProcessorMT leaves implicit multi-threading enabled after a call to Process

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.22/00
    • Component/s: None
    • Labels:
      None
    • Environment:

      any

      Description

      When TThreadExecutor creates the IMT thread pool (as opposed to when the thread pool is explicitly created by users via ROOT::EnableImplicitMT), it deletes it at destruction time:

      {
        TThreadExecutor p(3);
        std::cout << ROOT::ImplicitMTPoolSize() << std::endl; // prints 3
      }
       std::cout << ROOT::ImplicitMTPoolSize() << std::endl; // prints 0
      

      The same cannot be said for TTreeProcessorMT, although the two classes should have consistent behavior:

            ROOT::TTreeProcessorMT proc("f.root", "t");
            std::cout << ROOT::GetImplicitMTPoolSize() << std::endl; // prints n_cores 
            proc.Process([](TTreeReader &) { });
         }
       
         std::cout << ROOT::GetImplicitMTPoolSize() << std::endl; // still prints n_cores!!
      

      This looks like a total accident: TTreeProcessorMT::Process makes use of TParTreeProcessingRAII, the constructor of which calls ROOT::EnableImplicitMT() (with no arguments) and the destructor of which never calls ROOT::DisableImplicitMT().

      I don't think this is the desired behavior, but I'd like to hear other opinions. Also, I don't know how to fix it, I am not familiar with how TParTreeProcessingRAII is expected to behave.

        Attachments

          Activity

            People

            • Assignee:
              eguiraud Enrico Guiraud
              Reporter:
              eguiraud Enrico Guiraud
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: