Skip to content

Commit

Permalink
Adapt to buffer pool to fix the new introduced apps. (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiaojian authored Jul 26, 2024
1 parent f8f50fb commit 16b38c0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions examples/analytical_apps/kclique/kclique_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ struct KCliqueMsg {
VID_T* data;
};

template <typename VID_T>
struct SerializedSize<KCliqueMsg<VID_T>> {
static size_t size(const KCliqueMsg<VID_T>& msg) {
return sizeof(int) + sizeof(int) + msg.size * sizeof(VID_T);
}
};

template <typename VID_T>
InArchive& operator<<(InArchive& arc, const KCliqueMsg<VID_T>& msg) {
arc << msg.prefix_size;
Expand All @@ -82,6 +89,14 @@ OutArchive& operator>>(OutArchive& arc, KCliqueMsg<VID_T>& msg) {
return arc;
}

template <typename VID_T>
FixedInArchive& operator<<(FixedInArchive& arc, const KCliqueMsg<VID_T>& msg) {
arc << msg.prefix_size;
arc << msg.size;
arc.add_bytes(msg.data, msg.size * sizeof(VID_T));
return arc;
}

template <typename FRAG_T>
struct KCliqueUtils {
using fragment_t = FRAG_T;
Expand Down
4 changes: 3 additions & 1 deletion grape/worker/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ class Worker {

comm_spec_ = comm_spec;
MPI_Barrier(comm_spec_.comm());
context_ = std::make_shared<context_t>(graph);
if (context_ == nullptr) {
context_ = std::make_shared<context_t>(graph);
}

initPool(pe_spec);
messages_.Init(comm_spec_.comm());
Expand Down

0 comments on commit 16b38c0

Please sign in to comment.