-
Notifications
You must be signed in to change notification settings - Fork 902
coll: make bcast ring unsigned-safe #13287
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
coll: make bcast ring unsigned-safe #13287
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A suggestion (feel free to ignore): this pattern occurs in multiple places here and could occur in other places. We could extract it into an inline function:
size_t rectified_diff(size_t a, size_t b){
return a > b ? a - b : 0;
}
1861ca1
to
5686600
Compare
good idea. i kept a helper routine inside this file as part of this PR. |
@devreal please review again when you have a chance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hppritcha! Looks good, just one nit
ompi/mca/coll/base/coll_base_bcast.c
Outdated
@@ -850,10 +860,8 @@ int ompi_coll_base_bcast_intra_scatter_allgather( | |||
* Allgather by recursive doubling | |||
* Each process has the curr_count elems in the buf[vrank * scatter_count, ...] | |||
*/ | |||
size_t rem_count = count - vrank * scatter_count; | |||
size_t rem_count = (count > vrank * scatter_count) ? count - vrank * scatter_count : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use rectify_diff
here too:
size_t rem_count = (count > vrank * scatter_count) ? count - vrank * scatter_count : 0; | |
size_t rem_count = rectify_diff(count, (size_t)(vrank * scatter_count)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!
5686600
to
9b2ff4a
Compare
@devreal recheck when you have a chance |
@dalcinl would you have suggestions on debugging what's going on with mpi4py? it looks like some kind of problem with generation of mpi4py internal docs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hppritcha!
@dalcinl never mind we are just going to disable the test_doc.py in our CI. |
In the conversion to support big count, there are several places where signed int's were replaced by unsigned types (size_t). Unfortunately there were a few places where signedness was being used and these need to be refactored. To find these places the -Wtype-limit gnu compile option was used. This compile option is added to the --enable-picky compile option list as part of this PR. Signed-off-by: Howard Pritchard <[email protected]>
9b2ff4a
to
0f34c42
Compare
In the conversion to support big count, there are several places where signed int's were replaced by unsigned types (size_t). Unfortunately there were a few places where signedness was being used and these need to be refactored.
To find these places the -Wtype-limit gnu compile option was used. This compile option is added to the --enable-picky compile option list as part of this PR.