Skip to content

Ability to do the same operations on multiple images in parallel? #61

@hbina

Description

@hbina

For example, lets say it is known that a given pipeline requires 2 input images and 3 output images and the user provides a total of 20 images, it should be possible to split this into 10 different operations right? Thus producing a total of 30 images.

This should be possible to implement because each image operations already have the signature method that tells how many images goes in and out of it (if possible).

The total output is easy, it should simply be however many images the final step generates.
The total input is a bit tricky because each step may generates additional images, so it needs to take these into account as well.
But I think I have an algorithm that should be able to determine this, but I have no idea if its "correct".

The algorithm to determines the total input images required for a given sequence of image operations is as follows (assuming each of these signatures return Some(_).

Given [(a1,b1), (a2, b2), (a3, b3), ...] where each tuple is the signature of each operations.
First, calculate how much extra images each step requires from the previous step.

For the 1st operation, it requires exactly a1 images i.e. a1 - 0.
The 2nd operations requires a2 images but the 1st step provides b1 images, so it only needs a2 - b1 images.
So on and so forth.

So we have something like,

[a1 - 0, a2 - b1, a3 - b2, ...]

Finally, the total input images required for this pipeline is just the sum of this array.

This will be a breaking change, so I am thinking of an additional flag like --parallel or something.

Some examples:

  1. [(3, 2), (2, 3)] => (3, 3)
  2. [(3, 2), (2, 2), (2, 3)] => (3, 3)
  3. [(2, 3), (8, 1)] => (7, 3)
  4. [(2, 8), (3, 1)] => (-3, 3) <== special case needed ....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions