Skip to content

Implement Adaptive-IBLT#22

Open
Chenxy517 wants to merge 24 commits into
masterfrom
adaptiveIBLT
Open

Implement Adaptive-IBLT#22
Chenxy517 wants to merge 24 commits into
masterfrom
adaptiveIBLT

Conversation

@Chenxy517
Copy link
Copy Markdown
Contributor

No description provided.

@Chenxy517 Chenxy517 requested a review from trachten May 28, 2025 01:49
Copy link
Copy Markdown
Contributor

@trachten trachten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider my comments and resubmit.

Comment thread CMakeLists.txt Outdated
${SYNC_BENCH_INC}/FromFileGen.h
)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many other possible systems (e.g., *BSD,iOS, ...) ... it may be more robust to simply check for the existance of a known library or include in a given directory.

void commSend(const Cuckoo &cf);

/**
* Sends list of size_t.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t is a type ... why is it being referred to as a parameter?

Comment thread include/GenSync/Syncs/Adaptive_IBLT.h Outdated

namespace std {
template <>
struct hash<NTL::ZZ> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in the std namespace? If it's a utility, it should be put in Auxiliary.h. If it is specific to Adapatibe_IBLT, then, perhaps, it should be a subclass.

Comment thread include/GenSync/Syncs/Adaptive_IBLT.h Outdated

class Adaptive_IBLT : public IBLT {
public:
Adaptive_IBLT(long numHashes, long numHashCheck, size_t expectedNumEntries, size_t valueSize);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs javadoc documentation.

Comment thread include/GenSync/Syncs/Adaptive_IBLT.h Outdated
public:
Adaptive_IBLT(long numHashes, long numHashCheck, size_t expectedNumEntries, size_t valueSize);

// List entries and record the peeled cell indices
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add proper javadoc, including parameter annotations

peeledKeys.insert(SMOKeys.begin(), SMOKeys.end());
mySyncStats.timerEnd(SyncStats::COMP_TIME);

// For test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put this through the Logger infrastructure.

.setValueSize(elementSize)
.build();

std::cout << "[Server]: Current Size: " << currentExpected << std::endl;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger

}
}

bool IBLTSync_Adaptive_PartialDecode::SyncServer(const shared_ptr<Communicant>& commSync,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again ... fairly long procedure; see above.

Comment thread src/test_adaptive.cpp Outdated
}
std::cout << "Elements added." << std::endl;

if (fork()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the testing infrastructure for Gensync (which I plan to overhaul soon).

void testGetStrings();
};

#endif //GENSYNC_IBLTSYNC_ADAPTIVETEST_H
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about your updated IBLT tests? Listing tests?

@Chenxy517
Copy link
Copy Markdown
Contributor Author

Chenxy517 commented Jun 27, 2025 via email

ZZ key = (**iter).to_ZZ();

if (peeledKeys.find(key) != peeledKeys.end()) {
std::cout << "[Client] Skip inserting already peeled key: " << key << std::endl;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Logger

@GregoryFan
Copy link
Copy Markdown
Contributor

There's not a lot I can add on as the major points have already been said, but other than those looks fine apart from a few places where Logger can be used instead of cout.

Copy link
Copy Markdown
Contributor

@trachten trachten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments on the "clean up" commit 7349e99.

Comment thread src/Communicants/Communicant.cpp Outdated
void Communicant::commSend(const vec_ZZ& vec) {
Logger::gLog(Logger::COMM, "... attempting to send: vec_ZZ " + toStr(vec));

const ZZ base = power_ZZ(2, 256) + 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 2^256? What if individual ZZ's are larger? Please add a test that considers very large ZZ to catch this.

@Chenxy517 Chenxy517 requested a review from GregoryFan August 7, 2025 19:05
Copy link
Copy Markdown
Contributor

@GregoryFan GregoryFan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@Chenxy517 Chenxy517 requested a review from trachten August 11, 2025 17:10
Copy link
Copy Markdown
Contributor

@trachten trachten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better ... still some minor corrections are needed.

Comment thread CMakeLists.txt Outdated
/opt/local/include
/opt/homebrew/include
)
if(NTL_INCLUDE_PATH MATCHES "/usr/local/include")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a cleaner way of getting the parent directory?


/**
* Sends a list of ZZ over the line.
* @param The list of ZZ to send.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, a vector of ZZ to send?

public:
/**
* Constructor.
* @param initExpected The initial guess of expected number of elements being stored
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "number of elements beingstored" mean?

* 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.
Copy link
Copy Markdown
Contributor

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?

size_t elementSize;

// Provides a hash function for NTL::ZZ by converting the value to a string and hashing that.
struct HashZZ {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a class?

Comment thread src/Communicants/Communicant.cpp Outdated
ZZ divisor, remainder;
DivRem(divisor, remainder, received, base);

append(result, to_ZZ(remainder-1)); // subtract back the 1 that was added when sent
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I'm not sure why you need the -1.

currentExpected = static_cast<size_t>(commSync->commRecv_int());
mySyncStats.timerEnd(SyncStats::COMM_TIME);

// construct new IBLT with updated size
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a helper function.

myIBLT.insert((**iter).to_ZZ(), (**iter).to_ZZ());
}

// Attempt to peel the elements
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be a helper function.

mySyncStats.timerEnd(SyncStats::IDLE_TIME);

// keep running until peeling succeed
while (true) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit dangerous ... do you want a timeout in case of stalling?

if (peeledKeys.find(key) != peeledKeys.end()) {
continue;
}
myIBLT.insert(key, key);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems wasteful to use a value that is identical to the key.

@Chenxy517 Chenxy517 requested a review from trachten August 19, 2025 02:44
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