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

Releasing the GIL during matrix image conversion #6520

Closed
hmaarrfk opened this issue Aug 22, 2022 · 2 comments · Fixed by #6418
Closed

Releasing the GIL during matrix image conversion #6520

hmaarrfk opened this issue Aug 22, 2022 · 2 comments · Fixed by #6418

Comments

@hmaarrfk
Copy link
Contributor

I'm wondering how you would prefer to deal with small PRs that release the GIL.

I understand that those can cause a lot of churn due to unintended consequences when considering resource utilization.

What did you do?

I opened a PR without raising a dedicated issue first.
#6418

What did you expect to happen?

Given I had done some research on the history of releasing the GIL during computation, I figured that it was OK to open the pull request first.
I was hoping for some comments or feedback, but I understand that different projects have different expectations on the order that things should happen.

What are your OS, Python and Pillow versions?

  • OS: Linux / Windows / OSX (All really!)
  • Python: 3.9
  • Pillow: 9.2.0

Code like this, will not be able to run in parallel on different threads.

import numpy as np
import PIL

image = np.zeros((1024, 1024, 3), dtype='uint8')
img = PIL.Image.fromarray(image)
matrix = (1, 2, 3, 4, 5, 6, 7, 8, 9)
final_image = np.asarray(
    img.convert(mode='RGB', matrix=matrix)
)
@radarhere
Copy link
Member

It is not a problem to open pull requests without issues.

Your PR just hasn't been reviewed yet.
I haven't reviewed it as I would like someone else with more C expertise to do so - you have mentioned 'unintended consequences', and that sounds like something I don't want to cause.
As for the other core contributors, I can only say that we are doing this in our spare time.

@hugovk
Copy link
Member

hugovk commented Aug 23, 2022

Yes, thanks for the PR! I'm in a similar position, not so familiar with the ins and outs of the GIL so would prefer someone else to review.

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

Successfully merging a pull request may close this issue.

3 participants