Skip to content

Change Snapshot option from file cache to TTree auto-flush parameter#595

Merged
amadio merged 1 commit intoroot-project:masterfrom
amadio:tdf-snapshot-autoflush
May 31, 2017
Merged

Change Snapshot option from file cache to TTree auto-flush parameter#595
amadio merged 1 commit intoroot-project:masterfrom
amadio:tdf-snapshot-autoflush

Conversation

@amadio
Copy link
Copy Markdown
Member

@amadio amadio commented May 30, 2017

Please take a look. Although the tests pass, this is not supposed to be merged yet, as I have yet to understand why it's so slow when we pass a positive auto-flush value to snapshot the tree.

@phsft-bot
Copy link
Copy Markdown

Starting build on gcc49/centos7, native/mac1012, gcc49/slc6, gcc62/slc6, native/ubuntu14 with CMake flags -Dvc=OFF -Dimt=ON -Dccache=ON

@amadio amadio changed the title [WIP] Change Snapshot option from file cache to TTree auto-flush parameter WIP:Change Snapshot option from file cache to TTree auto-flush parameter May 30, 2017
@amadio amadio changed the title WIP:Change Snapshot option from file cache to TTree auto-flush parameter WIP: Change Snapshot option from file cache to TTree auto-flush parameter May 30, 2017
@amadio amadio changed the title WIP: Change Snapshot option from file cache to TTree auto-flush parameter WIP: Change Snapshot option from file cache to TTree auto-flush parameter ⚠️ May 30, 2017
@amadio amadio changed the title WIP: Change Snapshot option from file cache to TTree auto-flush parameter ⚠️ WIP: Change Snapshot option from file cache to TTree auto-flush parameter May 30, 2017
}
trees[slot]->Fill();
if (files[slot]->GetBytesWritten() >= cachesize) files[slot]->Write();
if (autoflush > 0 && trees[slot]->GetEntries() % autoflush == 0)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to have used the condition below, but somehow that blocks progress and the snapshot gets stuck when autoflush < 0.

if ((autoflush > 0 && trees[slot]->GetEntries() % autoflush == 0) ||
    (autoflush < 0 && trees[slot]->GetZipBytes() >= -autoflush))
   files[slot]->Write();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From where that code stands, it should 'never' act when autoflush is negative anyway (because it needs to act only after at least one cluster has been closed).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true. However, never acting when autoflush is negative means that buffers are never sent to be merged until the end, in which case the user may blow up the memory on his system and lose his whole analysis...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in which case the user may blow up the memory

The memory is still limited by the TTree itself (i.e. the size of the cluster * the compression) and adding the test where you have would not, by definition, change that limit ....

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The memory of the TTree is limited. However, the memory of the TMemFile where things end up is not (i.e. TBufferMergerFile).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, the disconnect was me mis-reading the current code which instead of using tree->GetAutoFlush() was using the parameter passed by the user. Using tree->GetAutoFlush is essential as the value changes as the TTree move from the first events (where GetAutoFlush is negative and expressed the desired size in compressed data size and during which the real cluster size is being determined) to the normal regime (when GetAutoFlush returns the size of the cluster in number of event).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, after the discussion I understand the problem and the solution now. However, after I changed the variable for the function call to tree->GetAutoFlush(), buffers are written every 4KB, which is very slow.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If by 'buffer are written' you mean the 'Write' is triggered very often ... then I am very confused (because it should only triggered when the cluster is full to 30Mb of compressed data) ... something must still be wrong with the test itself ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the value of GetAutoFlush and GetEntries when the if-statement triggers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I used the wrong branch of the tests by mistake. Those still use megabytes as the unit, which made the write happen way too often.

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1012/native.
See console output.

Failing tests:

@amadio amadio force-pushed the tdf-snapshot-autoflush branch from 53b33e3 to aa40254 Compare May 30, 2017 17:28
@phsft-bot
Copy link
Copy Markdown

Starting build on gcc49/centos7, native/mac1012, gcc49/slc6, gcc62/slc6, native/ubuntu14 with CMake flags -Dvc=OFF -Dimt=ON -Dccache=ON

@phsft-bot
Copy link
Copy Markdown

Build failed on ubuntu14/native.
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on slc6/gcc62.
See console output.

Failing tests:

@amadio amadio force-pushed the tdf-snapshot-autoflush branch from aa40254 to 8dce471 Compare May 31, 2017 06:33
@phsft-bot
Copy link
Copy Markdown

Starting build on gcc49/centos7, native/mac1012, gcc49/slc6, gcc62/slc6, native/ubuntu14 with CMake flags -Dvc=OFF -Dimt=ON -Dccache=ON

@amadio amadio force-pushed the tdf-snapshot-autoflush branch from 8dce471 to fab2053 Compare May 31, 2017 08:41
@phsft-bot
Copy link
Copy Markdown

Starting build on gcc49/centos7, native/mac1012, gcc49/slc6, gcc62/slc6, native/ubuntu14 with CMake flags -Dvc=OFF -Dimt=ON -Dccache=ON

@amadio amadio changed the title WIP: Change Snapshot option from file cache to TTree auto-flush parameter Change Snapshot option from file cache to TTree auto-flush parameter May 31, 2017
@amadio amadio force-pushed the tdf-snapshot-autoflush branch from fab2053 to 2353b78 Compare May 31, 2017 10:19
@amadio amadio merged commit 8461f69 into root-project:master May 31, 2017
@amadio amadio deleted the tdf-snapshot-autoflush branch May 31, 2017 10:19
@phsft-bot
Copy link
Copy Markdown

Starting build on gcc49/centos7, native/mac1012, gcc49/slc6, gcc62/slc6, native/ubuntu14 with CMake flags -Dvc=OFF -Dimt=ON -Dccache=ON

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1012/native.
See console output.

Failing tests:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants