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

repo sync #182

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions yacl/link/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,13 @@ Buffer Context::RecvInternal(size_t src_rank, const std::string& key) {
return value;
}

std::unique_ptr<Context> Context::Spawn() {
std::unique_ptr<Context> Context::Spawn(const std::string& id) {
ContextDesc sub_desc = desc_;
sub_desc.id = fmt::format("{}-{}", desc_.id, child_counter_++);
if (id.empty()) {
sub_desc.id = fmt::format("{}-{}", desc_.id, child_counter_++);
} else {
sub_desc.id = fmt::format("{}-{}", desc_.id, id);
}

// sub-context share the same event-loop and statistics with parent.
auto sub_ctx =
Expand Down
3 changes: 1 addition & 2 deletions yacl/link/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class Context {
void ConnectToMesh(
spdlog::level::level_enum connect_log_level = spdlog::level::debug);

std::unique_ptr<Context> Spawn();
std::unique_ptr<Context> Spawn(const std::string& id = "");

// Create a new Context from a subset of original parities.
// Party which not in `sub_parties` should not call the SubWorld() method.
Expand Down Expand Up @@ -327,7 +327,6 @@ class Context {
// stateful properties.
size_t counter_ = 0U; // collective algorithm counter.
std::map<P2PDirection, int> p2p_counter_;

size_t child_counter_ = 0U;

uint64_t recv_timeout_ms_;
Expand Down
Loading