Implementation of MapReduce using TTG - #221
Draft
pnookala wants to merge 2 commits into
Draft
Conversation
devreal
reviewed
Mar 4, 2022
| using namespace ttg; | ||
|
|
||
| template<typename T> | ||
| using Key = std::pair<std::pair<std::string, T>, T>; |
Contributor
There was a problem hiding this comment.
Do we need to send the filename as part of the key? Is it used after reading from the file?
Collaborator
Author
There was a problem hiding this comment.
This example counts words from multiple files. In order to keep the keys unique, I included filename in the key. We can probably come up with a different way of having unique keys as well without using the filename like a file ID for example.
devreal
reviewed
Mar 4, 2022
| { | ||
| std::transform(word.begin(), word.end(), word.begin(), ::tolower); | ||
| //std::cout << "Mapped " << word << std::endl; | ||
| resultMap.insert(std::make_pair(word, 1)); |
Contributor
There was a problem hiding this comment.
What if the chunk contains the same word twice? And why use a multimap in the first place?
Collaborator
Author
There was a problem hiding this comment.
I used multimap to be able to hold duplicate keys and have them sorted which makes counting easier in this example.
therault
marked this pull request as draft
April 25, 2022 15:44
evaleev
force-pushed
the
master
branch
4 times, most recently
from
November 24, 2025 13:22
a2878ce to
a49eb91
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This example counts the words in given files and prints the output to screen. Reduction is inefficient since it happens in a single process. This example works with the parsec backend, but there is an issue with the madness backend where it complains about unprocessed tasks, but the tasks actually get executed. This could be a problem with hashing std::string and needs to be fixed.