Skip to content
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

Merged
merged 16 commits into from
Jul 22, 2020
Merged

Add multiset support for IBLT #66

merged 16 commits into from
Jul 22, 2020

Conversation

arorashu
Copy link
Collaborator

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

All existing test cases pass.
Added new test case for multiset IBLT

This addresses Issue#63 and Issue#64.

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
@arorashu
Copy link
Collaborator Author

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.

@trachten
Copy link
Owner

trachten commented Jul 20, 2020 via email

@arorashu
Copy link
Collaborator Author

Updated with class based implementation

@novakboskov
Copy link
Collaborator

Updated with class based implementation

Great! I'm going to review this today.

Copy link
Collaborator

@novakboskov novakboskov left a 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.


private:
/**
*
Copy link
Collaborator

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) {
Copy link
Collaborator

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.

Copy link
Collaborator

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;
Copy link
Collaborator

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.

Copy link
Collaborator Author

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);
Copy link
Collaborator

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.

if (count != 0 && keySum!=0) {
long absCount = abs(count);
long plusOrMinus;
NTL::conv(plusOrMinus, keySum / abs(keySum));
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

@novakboskov novakboskov merged commit ad06b44 into master Jul 22, 2020
@arorashu arorashu deleted the ibltsync-multiset branch August 3, 2020 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants