I have a single file with a single ROOT tree and would like to read it with uproot4 in multiple processes, with each of them reading disjoint parts of the tree.
With uproot3 this was possible by passing an iterable for entrysteps
:
def index_generator(rank, nranks, numentries, chunk_size):
start = int(numentries / nranks * rank)
stop = int(numentries / nranks * (rank + 1))
index = start
while index < stop:
yield (index, min(index + chunk_size, stop))
index += chunk_size
entrysteps = index_generator(rank, nranks, numentries, chunk_size)
iterator = uproot.tree.iterate(
filename, treename, branches=branches,
namedecode="utf-8", entrysteps=entrysteps)
I uproot4 entrysteps
seems to have been replaced by step_size
, which does not accept an iterator anymore.
Is there currently a way to do this in uproot4? If not, is such an option planned?