Skip to content

add THREADING_LAYER_PRIORITY & NUMBA_THREADING_LAYER_PRIORITY - #7234

Merged
sklam merged 21 commits into
numba:masterfrom
ickc:issue-4486
Oct 5, 2021
Merged

sklam merged 21 commits into
numba:masterfrom
ickc:issue-4486

Conversation

@ickc

@ickc ickc commented Jul 22, 2021

Copy link
Copy Markdown
Contributor

Reference an existing issue

Close #4486.

@esc esc added 3 - Ready for Review Effort - short Short size effort needed labels Jul 22, 2021
@esc

esc commented Jul 22, 2021

Copy link
Copy Markdown
Member

@ickc thank you for your submission and welcome to the Numba project! I have labeled your pull-request as "ready for review" and added it to the backlog. I have also labeled it as being a short review effort since the changes appear to be fairly straightforward. Note however, that we are currently in a release candidate phase (RC2 was published 19.07.2021) and so we are currently focused on any release critical bugs. This means it may potentially be some time until we can review it. We thank you in advance for you patience and understanding!

@esc

esc commented Jul 22, 2021

Copy link
Copy Markdown
Member

@ickc do you want me to remove the "ready for review" label again?

@ickc

ickc commented Jul 22, 2021

Copy link
Copy Markdown
Contributor Author

@esc, do you think a test is needed? It seems that it should be residing in numba/tests/test_parallel_backend.py but I'm not sure how to test it as it is stateful.

I also want to test it locally first to make sure it is doing as claimed so may be removing the "ready for review" for now. Thanks.

@esc

esc commented Jul 22, 2021

Copy link
Copy Markdown
Member

I also want to test it locally first to make sure it is doing as claimed so may be removing the "ready for review" for now. Thanks.

You got it! 👍

@esc

esc commented Jul 22, 2021

Copy link
Copy Markdown
Member

@esc, do you think a test is needed? It seems that it should be residing in numba/tests/test_parallel_backend.py but I'm not sure how to test it as it is stateful.

Yes a test would be good. Also a test for the failure case and parsing the error message would be suitable. Not sure about the statefulness however.

ickc added 4 commits July 22, 2021 14:36
in TestThreadingLayerPriority where
parallel is not supported in 32-bit systems
@ickc
ickc marked this pull request as ready for review July 23, 2021 03:02

@stuartarchibald stuartarchibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This is a good start and it's great to see this functionality added. I've given this an initial review, most comments are small things but there's a couple of more involved things in relation to testing. If anything is not clear please do ask :) Thanks again for working on this.

Comment thread numba/tests/test_parallel_backend.py Outdated
Comment thread numba/tests/test_parallel_backend.py Outdated
Comment thread numba/np/ufunc/parallel.py Outdated
Comment thread numba/tests/test_parallel_backend.py Outdated
Comment thread numba/tests/test_parallel_backend.py Outdated
Comment thread docs/source/user/threading-layer.rst Outdated
Comment thread docs/source/user/threading-layer.rst Outdated
Comment thread numba/core/config.py
Comment thread numba/np/ufunc/parallel.py Outdated
Comment thread numba/np/ufunc/parallel.py Outdated
@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review Effort - medium Medium size effort needed and removed 3 - Ready for Review Effort - short Short size effort needed labels Aug 3, 2021
ickc and others added 5 commits August 26, 2021 14:30
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
@ickc

ickc commented Aug 27, 2021

Copy link
Copy Markdown
Contributor Author

@stuartarchibald, ready for a 2nd round review.

@ickc
ickc requested a review from stuartarchibald August 27, 2021 01:42
@gmarkall gmarkall added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels Aug 27, 2021

@stuartarchibald stuartarchibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, few minor things to resolve else looks good.

Comment thread docs/source/user/threading-layer.rst Outdated
Comment thread docs/source/user/threading-layer.rst Outdated
Comment thread docs/source/user/threading-layer.rst Outdated
Comment on lines +551 to +552
print(' '.join(numba.config.THREADING_LAYER_PRIORITY))
print("@%s@" % numba.threading_layer(), file=sys.stderr)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using stdout/stderr, perhaps just make these into assertions such that the process will exit non-zero if there's a problem. The use of stdout/stderr relies on these streams never having unexpected things written to them (e.g. a deprecation warning) which makes their use more fragile.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stdout should be safe. The stderr pattern @%s@ is actually copied from other tests in Numba (if you search this string in the same file there are 2 other such uses.) So I was just following whatever is practicing in Numba already...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stdout should be safe. The stderr pattern @%s@ is actually copied from other tests in Numba (if you search this string in the same file there are 2 other such uses.) So I was just following whatever is practicing in Numba already...

This is one of the things the code base has been moving away from as it's a little error prone. As it's variables that are ending up as strings to test, having an assert on the actual variables is cheap and reduces maintenance burden. In the interests of getting this feature merged and pre-existing use of this pattern I'm included to leave it. I'll make a note of this pattern as something to refactor generally.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7458 tracks.

Comment thread numba/core/config.py
@@ -306,6 +306,11 @@ def avx_default():
DISABLE_JIT = _readenv("NUMBA_DISABLE_JIT", int, 0)

# choose parallel backend to use

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment does not match this variable, it belongs to THREADING_LAYER.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But shouldn't both THREADING_LAYER_PRIORITY and THREADING_LAYER are part of the "choose parallel backend to use" process?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the THREADING_LAYER, if prescribed, will act as the choice for the parallel backend in use, whereas the THREADING_LAYER_PRIORITY sets preference for use of threading layers in the case that no explicit choice is prescribed?

@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 4 - Waiting on reviewer Waiting for reviewer to respond to author labels Sep 10, 2021
ickc and others added 2 commits September 10, 2021 15:56
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
@ickc

ickc commented Sep 10, 2021

Copy link
Copy Markdown
Contributor Author

@stuartarchibald, thanks for the review. I resolved some trivial ones. For the 2 remaining open ones, I commented them and see if you agree with it.

@stuartarchibald stuartarchibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch and fixes.

@stuartarchibald stuartarchibald added 5 - Ready to merge Review and testing done, is ready to merge and removed 4 - Waiting on author Waiting for author to respond to review labels Oct 5, 2021
@stuartarchibald stuartarchibald added this to the Numba 0.55 RC milestone Oct 5, 2021
@sklam
sklam merged commit 52f74d8 into numba:master Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to merge Review and testing done, is ready to merge Effort - medium Medium size effort needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature request] user defined priorities of automatic threading layer choice

5 participants