-
Notifications
You must be signed in to change notification settings - Fork 59
OperatorWrapper causes slowness and high memory consumption #175
Comments
I completely agree. I don't think we can eliminate OperatorWrappers entirely, but in cases where we are simply using them to (for example) process a 5D volume as a sequence of 4D volumes, it should be possible to implement some other abstraction, as you mention. (We can't replace OperatorWrappers if the inner operators' slots don't have identical metadata, like shape, dtype, and axistags. So the top-level OperatorWrappers that define the lanes of an ilastik applet must remain as they are, I think.) It will take some trial-and-error to come up with a satisfactory solution. Some questions that come to mind:
|
I checked the lazyflow operators again and I might have been wrong regarding state: most operators apparently do not keep an internal state. However, some operators (like lazy class OpWrap(Operator):
def __init__(self, OpToWrap):
self._op = OpToWrap(parent=self)
self._select = SubregionSelector(OpToWrap)
def setupOutputs(self):
# ... connect internal operator to outer slots 1-to-1
for name, slot in self.outputs.iteritems():
slot.meta.assignFrom(self._op.outputs[name].meta)
# ... disconnect internal operator and connect it to the subregionselector
def execute(self, slot, subindex, roi, result):
for t in range(roi.start[0], roi.stop[0]):
# select a subregion and feed it to the wrapped operator, execute We would have to check -- for each occurence of |
For reference: Operators currently wrapped in lazyflow and ilastik codebase:
|
In principle, the
OperatorWrapper
class was a neat concept, but I think we are at a point where it hinders us more than it helps. It is (at least partially) responsible for the problems in ilastik/ilastik#1075 and ilastik/ilastik#718, i.e. terrible usage of workflows with many time slices or many lanes.The problem:
setupOutputs()
andpropagateDirty()
callsThe problem was 'solved' in some places by putting a custom for-loop in execute which loops over time slices (see
opLabelVolume.OpLabelingABC
for real world example):Can we do it a bit more general than this? It would also be nice if we did not have to rewrite all occurences of
OperatorWrapper
... What comes to my mind is either lazy allocation of inner operators, or a special operator typeStatelessOperator
which can be reused inside wrappers.The text was updated successfully, but these errors were encountered: