# How to merge ROOT files larger than 100 GB

**URL:** <https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562>\
**Category:** ROOT\
**Created:** [February 16, 2021, 2:43pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562 "2021-02-16T14:43:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 16, 2021, 2:43pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/1 "2021-02-16T14:43:50Z")

</div>

Dear ROOT users  
How can I merge .root files larger than 100 GB?  
Thank you

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [February 17, 2021, 11:27am UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/2 "2021-02-17T11:27:48Z")

</div>

Hello,

I think this answer by @pcanal can be useful:

> [@Root 6.04.14 hadd 100Gb and rootlogon](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-and-rootlogon/24581):
>
> Dear experts, I am currently trying to use hadd to make an output file with a tree with size \> 100 Gb. I read: [https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-tfilemerger-recursiveremove/24117/4](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-tfilemerger-recursiveremove/24117/4) and: It seems that in my case the easiest solution is to create in the directory I execute “hadd” a rootlogon.C file with: { TTree::SetMaxTreeSize( 1000000000000LL ); // 1 TB } However, it seems that when I run “hadd” this new option is not taken into account. I tried two commands: h…

Cheers,  
Enric

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 17, 2021, 5:37pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/3 "2021-02-17T17:37:22Z")

</div>

Thank you for your reply.  
Should I create a shared library and set the LD\_LIBRARY\_PATH to it?  
I am a Geant4/GATE Monte Carlo user, where do I create the shared library?  
Thank you again.

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [February 18, 2021, 8:40am UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/4 "2021-02-18T08:40:46Z")

</div>

Hello,

Actually what @pcanal suggests is to create a shared library that you preload before running `hadd`:

`LD_PRELOAD=startup_C.so hadd output.root input_*`

You can create the shared library in the same directory where the ROOT files to be merged are.

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 19, 2021, 10:56am UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/5 "2021-02-19T10:56:13Z")

</div>

Hi Enric  
Thank you for your reply. BUT I have a problem when I merge the root files:  
When the size of all splits was about 420 GB it was merged to about 300 GB and then stopped. To override this, I reduced my run time and the size of all splits was about 250 GB but when I used this method to merge them it stopped at about 186 GB. How can I resolve this error? Did you face the same condition?  
Cheers,  
Hadi

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 19, 2021, 11:15am UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/6 "2021-02-19T11:15:01Z")

</div>

I compiled directly the C++ program using “root.exe -b -l -q startup.C+” command in the directory where the root files are in and then used “LD\_PRELOAD=startup\_C.so hadd output.root input\_\*”. Should I do separate work to create a shared library and addressed it in .bashrc using LD\_LIBRARY\_PATH?  
Thank you so much.

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [February 19, 2021, 12:09pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/7 "2021-02-19T12:09:09Z")

</div>

@pcanal can you comment on why it can be that the size of the merged result is smaller than the sum of the size of the individual fragments?

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [February 19, 2021, 12:10pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/8 "2021-02-19T12:10:51Z")

</div>

> I compiled directly the C++ program using “root.exe -b -l -q startup.C+” command in the directory where the root files are in and then used “LD\_PRELOAD=startup\_C.so hadd output.root input\_\*”. Should I do separate work to create a shared library and addressed it in .bashrc using LD\_LIBRARY\_PATH?

No, it should be enough to preload that little shared library that sets the maximum tree size before hadd operates.

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 20, 2021, 5:45pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/9 "2021-02-20T17:45:58Z")

</div>

@pcanal I have a problem merging the root files larger than 100 GB that I described in previous messages. How can I resolve it? I used root\_v6.14.00 and I addressed the startup\_C.so directory in .bashrc using LD\_LIBRARY\_PATH.  
Thank you so much.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 20, 2021, 11:23pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/10 "2021-02-20T23:23:11Z")

</div>

@hadirezaei I am not sure. What is the result of calling:

```auto
file = TFile::Open(filename);
file->ls();

```

for both one of the input and the result.  
and

```auto
tree->Print();

```

for your TTree (both for one input and the output).

Cheers,  
Philippe.

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 21, 2021, 5:38pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/11 "2021-02-21T17:38:01Z")

</div>

@pcanal thank you for your response.  
How can I use these commands?  
and another point is that when I compile the startup.C program I find this warning: " Warning in cling::IncrementalParser::CheckABICompatibility():  
Possible C++ standard library mismatch, compiled with **GLIBCXX** ‘20180415’  
Extraction of runtime standard library version was: ‘20191114’  
(int) 0"  
Could the merging issue be the cause of this warning? and How can I resolve it?  
Thank you so much.  
Hadi

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 21, 2021, 6:14pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/12 "2021-02-21T18:14:11Z")

</div>

I used ROOT 6.14/00 and g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0.  
Cheers,  
Hadi

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 24, 2021, 10:26am UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/13 "2021-02-24T10:26:01Z")

</div>

Dear ROOT users  
which version of the gcc match to the ROOT 6.14/00?  
Best  
Hadi

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 24, 2021, 3:25pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/14 "2021-02-24T15:25:15Z")

</div>

> [@hadirezaei](#):
>
> I find this warning: " Warning in cling::IncrementalParser::CheckABICompatibility():

This warning is fatal … and make the library unused. So we need to fix that problem first.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 24, 2021, 3:26pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/15 "2021-02-24T15:26:07Z")

</div>

> [@hadirezaei](#):
>
> which version of the gcc match to the ROOT 6.14/00?

It depends where/when/how it was built. You indeed need to make sure that you use the same gcc version for your code as with the one use to build ROOT.

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 25, 2021, 6:34pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/16 "2021-02-25T18:34:43Z")

</div>

@pcanal  
Thank you for your response.  
How can I fix it?  
Best  
Hadi

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 25, 2021, 7:02pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/17 "2021-02-25T19:02:27Z")

</div>

By using the same compiler for ROOT and your code.

So the primary question is “where/when/how ROOT was built.” and/or where did you get it from? From that answer you will be able to tell whether you need to:

- Select a different build from the same place
- or Find another place to download ROOT from
- or Use a different compiler
- or Build ROOT yourself.

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 25, 2021, 7:28pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/18 "2021-02-25T19:28:45Z")

</div>

I got it from [Release 61400 - ROOT](https://root.cern/releases/release-61400/) and I installed it using CMake.  
Thanks

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [February 25, 2021, 7:56pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/19 "2021-02-25T19:56:00Z")

</div>

So you downloaded the source tar file and built it using cmake and the default compiler?

---

<div class="post-metadata">

**Author:** ![hadirezaei](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hadirezaei/32/24880_2.png) [@hadirezaei](https://root-forum.cern.ch/u/hadirezaei)\
**Post date:** [February 26, 2021, 3:35pm UTC](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562/20 "2021-02-26T15:35:00Z")

</div>

@pcanal yes, I did it.

[Next page](https://root-forum.cern.ch/t/how-to-merge-root-files-larger-than-100-gb/43562.md?page=2)
