-
Notifications
You must be signed in to change notification settings - Fork 3
Implement Adaptive-IBLT #22
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
Open
Chenxy517
wants to merge
24
commits into
master
Choose a base branch
from
adaptiveIBLT
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c349e16
create IBLTSync_Adaptive
Chenxy517 ed598eb
fix server client connection issue
Chenxy517 f325f4f
minor update
Chenxy517 e727eec
update BenchParams
Chenxy517 124ed04
functionally correct
Chenxy517 794e9f1
ready for benchmark
Chenxy517 8f6be44
fix communication time issue
Chenxy517 1dd3543
test
Chenxy517 1a51cef
add tests and clean up
Chenxy517 21ee121
add tests and clean up
Chenxy517 cc126e6
add tests and clean up
Chenxy517 629e8c4
clean up
Chenxy517 20274c6
implement partial decoding
Chenxy517 19108f9
fix issue of inserting dupicated elements
Chenxy517 d3babd7
optimize communication cost
Chenxy517 183b4c2
minor update
Chenxy517 4a6289e
implement partial-decoding for adaptive-iblt
Chenxy517 8b597f7
minor update
Chenxy517 9e0e098
updates on Adaptive and docs
Chenxy517 7349e99
clean up
Chenxy517 c4385a3
addressed comments from review
Chenxy517 19ef1e4
minor update
Chenxy517 42bf02c
update README
Chenxy517 237fd77
addressed comments on PR
Chenxy517 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* This code is part of the GenSync project developed at Boston University. Please see the README for use and references. */ | ||
|
|
||
| /** | ||
| * The {@link IBLTSync_Adaptive} method syncs with another {@link IBLTSync_Adaptive} method by sending an IBLT containing | ||
| * its set. Upon receiving this IBLT, the server performs a subtract operation on both IBLTs | ||
| * and uses the resulting IBLT to calculate the symmetric set difference. These differences | ||
| * are then sent back to the client. If the decoding process failed, we construct an IBLT with doubled size | ||
| * (which is the optimal strategy with respect to overhead over the "clairvoyant" IBLT) and re-run the synchronization. | ||
| * There is an adjustable probability that the sync will fail to recover all differences. | ||
| * | ||
| * Created by Xingyu Chen on 4/27/25. | ||
| */ | ||
|
|
||
| #ifndef GENSYNC_IBLTSYNC_ADAPTIVE_H | ||
| #define GENSYNC_IBLTSYNC_ADAPTIVE_H | ||
|
|
||
| #include <GenSync/Aux/SyncMethod.h> | ||
| #include <GenSync/Syncs/IBLT.h> | ||
|
|
||
| /** | ||
| * IBLTSync_Adaptive class dynamically grows the IBLT if reconciliation fails. | ||
| */ | ||
| class IBLTSync_Adaptive : public SyncMethod | ||
| { | ||
| public: | ||
| /** | ||
| * Constructor. | ||
| * @param initExpected The initial guess of set difference size between client and server | ||
| * @param eltSize The size of elements being sent over between client and server | ||
| */ | ||
| explicit IBLTSync_Adaptive(size_t initExpected, size_t eltSize); | ||
|
|
||
| ~IBLTSync_Adaptive() override; | ||
|
|
||
| // Implemented parent class methods | ||
| bool SyncClient(const shared_ptr<Communicant>& commSync, | ||
| list<shared_ptr<DataObject>> &selfMinusOther, | ||
| list<shared_ptr<DataObject>> &otherMinusSelf) override; | ||
|
|
||
| bool SyncServer(const shared_ptr<Communicant>& commSync, | ||
| list<shared_ptr<DataObject>> &selfMinusOther, | ||
| list<shared_ptr<DataObject>> &otherMinusSelf) override; | ||
|
|
||
| /** | ||
| * Helper Function for constructing IBLT and inserting elements. | ||
| * @param currentExpected The current guess of set difference size between client and server | ||
| * @param elementSize The size of elements being sent over between client and server | ||
| */ | ||
| IBLT buildIBLT(size_t currentExpected, size_t elementSize); | ||
|
|
||
| bool addElem(shared_ptr<DataObject> datum) override; | ||
| bool delElem(shared_ptr<DataObject> datum) override; | ||
|
|
||
| string getName() override; | ||
|
|
||
| /* Getters for the parameters set in the constructor */ | ||
| size_t getInitExpNumElems() const {return initExpNumElems;} | ||
| size_t getElementSize() const {return elementSize;} | ||
| private: | ||
| // Initial value of estimated number of difference | ||
| size_t initExpNumElems; | ||
|
|
||
| // Size of elements | ||
| size_t elementSize; | ||
|
|
||
| // Number of elements | ||
| size_t elementCount = 0; | ||
| }; | ||
|
|
||
| #endif //GENSYNC_IBLTSYNC_ADAPTIVE_H |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /** | ||
| * The {@link IBLTSync_Adaptive_PartialDecode} method syncs with another {@link IBLTSync_Adaptive_PartialDecode} method by sending an IBLT containing | ||
| * its set. Upon receiving this IBLT, the server performs a subtract operation on both IBLTs | ||
| * and uses the resulting IBLT to calculate the symmetric set difference. These differences | ||
| * are then sent back to the client. If the decoding process failed, we construct an new IBLT. | ||
| * The new IBLT is built with doubled size minus the number of peeled elements and we do not insert peeled elements. | ||
| * There is an adjustable probability that the sync will fail to recover all differences. | ||
| * This type of syncs is a variance of {@link IBLTSync_Adaptive}. | ||
| * | ||
| * Created by Xingyu Chen on 6/5/25. | ||
| */ | ||
|
|
||
| #ifndef GENSYNC_IBLTSYNC_ADAPTIVE_PARTIALDECODE_H | ||
| #define GENSYNC_IBLTSYNC_ADAPTIVE_PARTIALDECODE_H | ||
|
|
||
| #include <GenSync/Aux/SyncMethod.h> | ||
| #include <GenSync/Syncs/IBLT.h> | ||
| #include <unordered_set> | ||
|
|
||
| /** | ||
| * IBLTSync_Adaptive_PartialDecode class dynamically grows the IBLT if reconciliation fails, it records the indices of peeled elements | ||
| * and do not insert them into the following generated IBLTs. | ||
| */ | ||
| class IBLTSync_Adaptive_PartialDecode : public SyncMethod | ||
| { | ||
| private: | ||
| // Initial value of estimated number of difference | ||
| size_t initExpNumElems; | ||
|
|
||
| // Size of elements | ||
| size_t elementSize; | ||
|
|
||
| // Number of elements | ||
| size_t elementCount = 0; | ||
|
|
||
| // Provides a hash function for NTL::ZZ by converting the value to a string and hashing that. | ||
| struct HashZZ { | ||
| size_t operator()(const ZZ& z) const { | ||
| return hash<string>()(zzToString(z)); | ||
| } | ||
| }; | ||
|
|
||
| public: | ||
| /** | ||
| * Constructor. | ||
| * @param initExpected The initial guess of set difference size between client and server | ||
| * @param eltSize The size of elements being sent over between client and server | ||
| */ | ||
| explicit IBLTSync_Adaptive_PartialDecode(size_t initExpected, size_t eltSize); | ||
|
|
||
| ~IBLTSync_Adaptive_PartialDecode() override; | ||
|
|
||
| // Implemented parent class methods | ||
| bool SyncClient(const shared_ptr<Communicant>& commSync, | ||
| list<shared_ptr<DataObject>> &selfMinusOther, | ||
| list<shared_ptr<DataObject>> &otherMinusSelf) override; | ||
|
|
||
| bool SyncServer(const shared_ptr<Communicant>& commSync, | ||
| list<shared_ptr<DataObject>> &selfMinusOther, | ||
| list<shared_ptr<DataObject>> &otherMinusSelf) override; | ||
|
|
||
| /** | ||
| * Helper Function for constructing IBLT and inserting elements that have not been peeled. | ||
| * @param currentExpected The current guess of set difference size between client and server | ||
| * @param elementSize The size of elements being sent over between client and server | ||
| * @param peeledKeys The set of keys | ||
| */ | ||
| IBLT buildIBLTwithUnpeeledElements(size_t currentExpected, size_t elementSize, unordered_set<ZZ, HashZZ> peeledKeys); | ||
|
|
||
| bool addElem(shared_ptr<DataObject> datum) override; | ||
| bool delElem(shared_ptr<DataObject> datum) override; | ||
|
|
||
| string getName() override; | ||
|
|
||
| /* Getters for the parameters set in the constructor */ | ||
| size_t getInitExpNumElems() const {return initExpNumElems;} | ||
| size_t getElementSize() const {return elementSize;} | ||
| }; | ||
|
|
||
| #endif //GENSYNC_IBLTSYNC_ADAPTIVE_PARTIALDECODE_H | ||
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
Oops, something went wrong.
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.
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.
Maybe a note that doubling in size is the optimal strategy with respect to overhead over the "clairvoyant" IBLT?