2

我有一个带有单个根树的文件,并且想在多个进程中使用 uproot4 读取它,每个进程都读取树的不相交部分。使用 uproot3 这可以通过传递一个可迭代的 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)

我 uproot4entrysteps似乎已被 取代step_size,它不再接受迭代器。

目前有没有办法在 uproot4 中做到这一点?如果没有,是否计划使用这样的选项?

4

0 回答 0