-
Notifications
You must be signed in to change notification settings - Fork 11
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 multiset support for IBLT #66
Conversation
1. load client & server data from file 2. run client process, server process 3. print stats about sync
- Use `IBLTSync_Multiset` in place of `IBLTSync` in tests where multiset is used - Default IBLT uses isMultiset=false
because defaulted default constructor defined outside the class is treated as user defined, and is initialized with garbage values
- create constructor to initialize the function pointers
Function pointers were the easiest way to get the same performance as inheritance, but with minimal code changes, i.e. we don't have to change IBLT usage in the code anywhere. However, I am working on a different implementation that does this using inheritance/templates now. |
thanks! Function pointers are messy because they can easily get corrupted ...
… On Jul 20, 2020, at 4:26 PM, 7/20/20, Shubham Arora ***@***.***> wrote:
Function pointers were the easiest way to get the same performance as inheritance, but with minimal code changes, i.e. we don't have to change IBLT usage in the code anywhere. However, I am working on a different implementation that does this using inheritance/templates now.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#66 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACM5LUZ7EJWEV5INQA6W7RTR4SR7ZANCNFSM4O2WHHIA>.
---
Ari Trachtenberg, Boston University
http://people.bu.edu/trachten mailto:trachten@bu.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Random quote of the day:
"For me, it is important to remember, but it is far more important to remember to act." - Simon Wiesenthal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
- create communication functions for IBLTMultiset
Updated with class based implementation |
Great! I'm going to review this today. |
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.
In the interest of time, I am going to address the minor issues myself, merge it, and then make an issue to require the refactoring of IBLTMultiset
.
include/CPISync/Syncs/IBLTMultiset.h
Outdated
|
||
private: | ||
/** | ||
* |
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.
Looks like you miss the comment here.
@@ -278,6 +278,18 @@ void Communicant::commSend(const IBLT& iblt, bool sync) { | |||
} | |||
} | |||
|
|||
void Communicant::commSend(const IBLTMultiset &iblt, bool sync) { |
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.
This is a kind of problem that comes with this kind of inheritance. You have void Communicant::commSend(const IBLT& iblt, bool sync)
and void Communicant::commSend(const IBLTMultiset &iblt, bool sync)
that are practically identical. And that is because sending an IBLT over the network apparently has nothing to do with the kind of adder you use in its implementation. And that tells us that it might be that Adder
is what needs its own class and not the IBLTWithSomeOtherAdder
.
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.
Alternatively, you can stick with this inheritance but then keep void Communicant::commSend(const IBLT &iblt, bool sync)
only. As IBLTMultiset
inherits from IBLT
that should work fine.
// must return positive modulus | ||
// C++ by default does not give positive modulus | ||
if (res < 0 ){ | ||
res += LARGE_PRIME; |
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.
Don't use unnecessary braces.
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.
Well I actually like being explicit here, just to avoid any future errors. But this is fine too :)
} | ||
|
||
void IBLTMultiset::erase(ZZ key, ZZ value) { | ||
_insertModular(-1, key, value); |
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.
Very bad idea to have _insertModular
actually removing stuff when a negative value is passed. At least, this should be two function API or the name of the method should be changed to something along the line of modify
.
src/Syncs/IBLTMultiset.cpp
Outdated
if (count != 0 && keySum!=0) { | ||
long absCount = abs(count); | ||
long plusOrMinus; | ||
NTL::conv(plusOrMinus, keySum / abs(keySum)); |
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.
We normally use the functional versions of the NTL conversions on this project.
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 for pointing out! Linking the doc here for reference, if it's of use to someone in the future.
Added multiset implementation for IBLT, that uses modular(residual) sums.
Created a new Sync IBLTSync_Multiset that derives from IBLTSync, similar to the existing IBLTSync_HalfRound.
Tests done
This addresses Issue#63 and Issue#64.