-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
add macro to create custom Ops also on aarch64 #871
Conversation
Need to delete Lines 7 to 10 in 609a8fe
|
No since I add it to this as well Line 70 in 609a8fe
|
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.
I only looked at the code and didn't try to run it.
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.
Just to understand: this works around the closures limitations by creating a custom module on-the-fly and defining the closure "statically" inside it?
Side note, it's a bit unfortunate that this is introducing an alternative method to Op
to define custom operators: generic libraries will have to pick either @Op
or Op
(presumably the former if they want to work on all platforms), but I guess we don't have more comprehensive solutions at the moment.
Also, should we add a reference to Line 95 in 780aaa0
MPI.@Op macro...
|
The situation is even funnier. So it doesn't introduce an alternative method, you still have to call |
Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com>
I like the new name much better, it makes the difference clearer, thanks! |
Should update documentation at https://juliaparallel.org/MPI.jl/stable/knownissues/#Custom-reduction-operators? |
With diff --git a/docs/examples/03-reduce.jl b/docs/examples/03-reduce.jl
index 86d22be1..26aa9658 100644
--- a/docs/examples/03-reduce.jl
+++ b/docs/examples/03-reduce.jl
@@ -33,8 +33,13 @@ end
X = randn(10,3) .* [1,3,7]'
+# Register the custom reduction operator. This is necessary only on platforms
+# where Julia doesn't support closures as cfunctions (e.g. ARM), but can be used
+# on all platforms for consistency.
+MPI.@RegisterOp(pool, SummaryStat)
+
# Perform a scalar reduction
-summ = MPI.Reduce(SummaryStat(X), pool, root, comm)
+summ = MPI.Reduce(SummaryStat(X), pool, comm; root)
if MPI.Comm_rank(comm) == root
@show summ.var
@@ -42,7 +47,7 @@ end
# Perform a vector reduction:
# the reduction operator is applied elementwise
-col_summ = MPI.Reduce(mapslices(SummaryStat,X,dims=1), pool, root, comm)
+col_summ = MPI.Reduce(mapslices(SummaryStat,X,dims=1), pool, comm; root)
if MPI.Comm_rank(comm) == root
col_var = map(summ -> summ.var, col_summ) I can run the custom reduction example in the documentation on aarch64-darwin, it errors in Line 98 in aac9688
MPI.@RegisterOp in that error message.
|
It turns out staticarrays is used? I'm missing where though 😕 |
Last bit: update the docsaabout known issues #871 (comment) and then we should be good to go for me! |
@giordano done! |
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.
Thank you so much, this is great!
Could we make use of the potential |
Yeah, I think that could be used to generally simplify the implementation, and also our home-grown implementation for other globals. |
No description provided.