-
Notifications
You must be signed in to change notification settings - Fork 5
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
Reducer documentation #97
Conversation
✅ Deploy Preview for sage-licorice-6da44d ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Some minor comments, to start things off:
|
I wrote the documentation in emacs using standard markdown and it was correct as written. Something in the uploading process quoted the &. I will try to edit the file on my branch to fix it. As for the code blocks, I don't think language tags are part of standard markdown. I will add them if we are only displaying the code on this web page. |
aadd493
to
33637f8
Compare
41e865f
to
64d90ec
Compare
Thanks @VoxSciurorum for documenting our new reducer functionality and tapping some reviewers. To complement this reference perspective, I wonder if we want to develop an OpenCilk tutorial that gets new parallel programmers interested in using reducers. I have collected Cilk Plus material along these lines into #146. It's very much a work in progress, but I'm curious if you agree that a tutorial along those lines would help? |
64d90ec
to
1053176
Compare
src/doc/reference/reducers.md
Outdated
|
||
Reducers are used when the final value in a variable is built up from | ||
a series of independent modifications. The modifications should all | ||
be of the same kind, such as by adding a number to an accumulator or |
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.
``Of the same kind'' is unclear
1053176
to
6d9ed4e
Compare
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.
Added a couple of comments. These comments are minor nits; I think this doc is essentially ready to deploy.
src/doc/reference/reducers.md
Outdated
much like `*`. In particular, | ||
|
||
```c | ||
Type cilk_reducer a, b; |
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.
For consistency with the rest of the code examples, I think we want cilk_reducer(I,R)
(or something like that) here, rather than just cilk_reducer
. That way it's clearer that one always needs to specify the arguments to the cilk_reducer
keyword.
src/doc/reference/reducers.md
Outdated
for more pleasing declarations: | ||
|
||
```c | ||
typedef Type cilk_reducer TypeReducer; |
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.
Likewise with my previous comment, I think we want cilk_reducer(I,R)
here, rather than just a bare cilk_reducer
.
src/doc/reference/reducers.md
Outdated
be correct. | ||
|
||
Formally, a reducer is a mathematical object called a _{% defn | ||
"monoid" %}_. A reducer has a type (e.g., `double`), an _identity_ |
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.
Minor nit: I'd prefer that the sentence that starts, A reducer has a type
, relates to the previous comment about a reducer being a monoid. Otherwise a reader might be confused about what the comment about a monoid has to do with the rest of the paragraph.
Here's a possible rephrasing:
Formally, a reducer is a mathematical object called a {% defn "monoid" %}, meaning it has the following components:
- a type (e.g.,
double
), - an identity value (e.g.,
0.0
), and - an associative binary operation (e.g.,
+
).
The operation does not need to be commutative...
author: John F. Carr | ||
--- | ||
|
||
# Reducers |
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'm not sure how everything will look once this page is merged with style fixes in other PRs. But right now I think this line can be removed, since the title "Reducers" already show up elsewhere on the page.
(For clarity, this comment applies specifically to line 6.)
src/doc/reference/reducers.md
Outdated
```c | ||
void zero_double(void *view) { *(double *)view = 0.0; } | ||
void add_double(void *left, void *right) | ||
{ *(double *)left += *(double *)right; } | ||
double cilk_reducer(zero_double, add_double) sum; | ||
``` |
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.
My inclination is to remove the leading indentation on the code within the code block (for this code block and all other code blocks in this document). Right now this indentation appears to add unnecessary whitespace to the code on the deployed page.
6d9ed4e
to
4f2f763
Compare
No description provided.