How to use TBufferMerger


ROOT Version: 6.32.02
Platform: Ubuntu 20.04
Compiler: g++ 9.4.0


I found slides from https://indico.jlab.org/event/459/contributions/11571/attachments/9442/13691/2023-CHEP-ROOT-IO.pdf. It shows that we can write faster with TBufferMerger. And I check the tutorial and found this, ROOT: tutorials/multicore/mt103_fillNtupleFromMultipleThreads.C File Reference. I have 2 questions:

  1. How to keep the entry number? For exaxmple, if I read events from input tree, analysis the events and fill to a new tree, I hope the events with the same entry number in input and output tree is correlated.
  2. Can it write faster? I’m not faimliar with low level IO in computer. Is it possible to touch the IO limitation of the computer with only one thread? If it’s possible, it seems that it won’t be faster with more threads since the limitation of IO.

Thank you for any kind of help

Hi,

thanks for the interesting questions!

  1. Operations in a multithreaded environment do not follow any implicit ordering, intrinsecally. Multithreaded writing is not an exception, and this is not a limitation of ROOT: the entries in the output will not be in the same order of the input.

  2. It can write faster, it depends of the usecase. If the bandwidth to the io device is saturated with one thread, of course it won’t bring much - that is not a limitation of ROOT, it’s dictated by the software.

I hope it helps,
D