feat: add BufferManager for more fine-grained control over VirtualArrays#1530
Open
pfackeldey wants to merge 2 commits intoscikit-hep:masterfrom
Open
feat: add BufferManager for more fine-grained control over VirtualArrays#1530pfackeldey wants to merge 2 commits intoscikit-hep:masterfrom
pfackeldey wants to merge 2 commits intoscikit-hep:masterfrom
Conversation
Collaborator
|
@lgray any takes on the API here? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a
BufferManagerclass that one can opt-in to use for more fine-grained control over virtual arrays and their buffers/generators. This only works when constructingeventswith abuffer_cacheandmode="virtual".The
BufferManagercurrently allows 2 things:eventsgets cleaned up. Accessing them again is no problem, but likely involves re-reading from disk.This is useful for more fine-grained control over memory usage. Users can free memory more aggressively and basically get rid of memory that, e.g., is only used once and never again.
The prefetching seems to be pretty efficient for runtime, see the following benchmarks:
Benchmark setup:
root://eospublic.cern.ch//eos/opendata/cms/mc/RunIISummer20UL16NanoAODv9/TTToHadronic_TuneCP5_13TeV-powheg-pythia8/NANOAODSIM/106X_mcRun2_asymptotic_v17-v1/130000/009086DB-1E42-7545-9A35-1433EC89D04B.rootcpulimit -l 100 -- python ...hyperfine --warmup 3 ...Results:
preload=NanoEventsFactory's
preload=is mainly beneficial for streaming over network, so this is why this isn't so beneficial here (input file is local).Could not try the prefetching yet with free-threaded python because not all dependencies support it yet, but it should only get better than these results.
To make proper use of this it needs the buffer cache PR #1508 first in.