Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hbina opened this issue Oct 10, 2021 · 0 comments
Open

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

hbina opened this issue Oct 10, 2021 · 0 comments

Comments

@hbina
Copy link
Contributor

hbina commented Oct 10, 2021

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 ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant