Skip to content

Commit

Permalink
CP should invoke partitioning (#107)
Browse files Browse the repository at this point in the history
* Invoke partitioning on the CP

* Small bug in ingest_rmat_el.cpp and making tc run on the CP
  • Loading branch information
AdityaAtulTewari authored May 25, 2024
1 parent 74b68a0 commit 678ecdf
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 28 deletions.
5 changes: 2 additions & 3 deletions microbench/triangle-counting/include/tc_algos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ template <typename GraphType>
void tc_chunk_vertices(pando::GlobalPtr<GraphType> graph_ptr,
galois::DAccumulator<uint64_t> final_tri_count);

void HBMainTC(pando::Notification::HandleType hb_done, pando::Array<char> filename,
int64_t num_vertices, bool load_balanced_graph, TC_CHUNK tc_chunk,
galois::DAccumulator<uint64_t> final_tri_count);
void HBMainTC(pando::Array<char> filename, int64_t num_vertices, bool load_balanced_graph,
TC_CHUNK tc_chunk, galois::DAccumulator<uint64_t> final_tri_count);

#endif // TRIANGLE_COUNTING_INCLUDE_TC_ALGOS_HPP_
2 changes: 1 addition & 1 deletion microbench/triangle-counting/include/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct CommandLineOptions {
: elFile(""), num_vertices(0), load_balanced_graph(false), tc_chunk(TC_CHUNK::NO_CHUNK) {}
};

std::shared_ptr<CommandLineOptions> read_cmd_line_args(int argc, char** argv);
std::unique_ptr<CommandLineOptions> read_cmd_line_args(int argc, char** argv);
void printUsageExit(char* argv0);
void printUsage(char* argv0);
// #####################################################################
Expand Down
12 changes: 4 additions & 8 deletions microbench/triangle-counting/src/tc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

int pandoMain(int argc, char** argv) {
auto thisPlace = pando::getCurrentPlace();
std::shared_ptr<CommandLineOptions> opts = read_cmd_line_args(argc, argv);
std::unique_ptr<CommandLineOptions> opts = read_cmd_line_args(argc, argv);

if (thisPlace.node.id == COORDINATOR_ID) {
galois::HostLocalStorageHeap::HeapInit();
Expand All @@ -22,13 +22,8 @@ int pandoMain(int argc, char** argv) {
galois::DAccumulator<uint64_t> final_tri_count{};
PANDO_CHECK(final_tri_count.initialize());

pando::Notification necessary;
PANDO_CHECK(necessary.init());
PANDO_CHECK(pando::executeOn(pando::Place{pando::NodeIndex{0}, pando::anyPod, pando::anyCore},
&HBMainTC, necessary.getHandle(), filename, opts->num_vertices,
opts->load_balanced_graph, opts->tc_chunk, final_tri_count));
necessary.wait();
filename.deinitialize();
HBMainTC(filename, opts->num_vertices, opts->load_balanced_graph, opts->tc_chunk,
final_tri_count);
std::cout << "*** FINAL TRI COUNT = " << final_tri_count.reduce() << "\n";

#if BENCHMARK
Expand All @@ -38,6 +33,7 @@ int pandoMain(int argc, char** argv) {
<< std::chrono::duration_cast<std::chrono::nanoseconds>(time_e2e_end - time_e2e_st).count()
<< "\n";
#endif
filename.deinitialize();
}
pando::waitAll();
return 0;
Expand Down
7 changes: 2 additions & 5 deletions microbench/triangle-counting/src/tc_algos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,12 @@ void HBGraphDA(pando::Place thisPlace, pando::Array<char> filename, int64_t num_
pando::deallocateMemory(graph_ptr, 1);
}

void HBMainTC(pando::Notification::HandleType hb_done, pando::Array<char> filename,
int64_t num_vertices, bool load_balanced_graph, TC_CHUNK tc_chunk,
galois::DAccumulator<uint64_t> final_tri_count) {
void HBMainTC(pando::Array<char> filename, int64_t num_vertices, bool load_balanced_graph,
TC_CHUNK tc_chunk, galois::DAccumulator<uint64_t> final_tri_count) {
auto thisPlace = pando::getCurrentPlace();

if (load_balanced_graph)
HBGraphDL(thisPlace, filename, num_vertices, tc_chunk, final_tri_count);
else
HBGraphDA(thisPlace, filename, num_vertices, final_tri_count);

hb_done.notify();
}
4 changes: 2 additions & 2 deletions microbench/triangle-counting/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <utils.hpp>

// Process command line flags
std::shared_ptr<CommandLineOptions> read_cmd_line_args(int argc, char** argv) {
std::shared_ptr<CommandLineOptions> opts_ptr = std::make_shared<CommandLineOptions>();
std::unique_ptr<CommandLineOptions> read_cmd_line_args(int argc, char** argv) {
std::unique_ptr<CommandLineOptions> opts_ptr = std::make_unique<CommandLineOptions>();

// Other libraries may have called getopt before, so we reset optind for correctness
optind = 0;
Expand Down
7 changes: 1 addition & 6 deletions microbench/triangle-counting/test/test_tc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ void e2e_tc_test(uint64_t expected_tc, pando::Array<char> filename, uint64_t num
bool load_balanced_graph, TC_CHUNK tc_chunk) {
galois::DAccumulator<uint64_t> final_tri_count;
EXPECT_EQ(final_tri_count.initialize(), pando::Status::Success);
pando::Notification necessary;
PANDO_CHECK(necessary.init());
PANDO_CHECK(pando::executeOn(pando::Place{pando::NodeIndex{0}, pando::anyPod, pando::anyCore},
&HBMainTC, necessary.getHandle(), filename, num_vertices,
load_balanced_graph, tc_chunk, final_tri_count));
necessary.wait();
HBMainTC(filename, num_vertices, load_balanced_graph, tc_chunk, final_tri_count);
EXPECT_EQ(final_tri_count.reduce(), expected_tc);
final_tri_count.deinitialize();
}
Expand Down
7 changes: 4 additions & 3 deletions src/ingest_rmat_el.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ pando::Vector<pando::Vector<galois::ELEdge>> galois::reduceLocalEdges(

for (std::uint64_t i = 0; i < localEdges.size(); i++) {
pando::Vector<pando::Vector<galois::ELEdge>> threadLocalEdges = *localEdges.get(i);
for (pando::Vector<galois::ELEdge> ev : threadLocalEdges) {
if (ev.size() > 0) {
ELEdge first_edge = ev[0];
for (pando::GlobalRef<pando::Vector<galois::ELEdge>> ev : threadLocalEdges) {
const pando::Vector<galois::ELEdge>& unboxEV = ev;
if (unboxEV.size() > 0) {
ELEdge first_edge = unboxEV[0];
uint64_t src = first_edge.src;
pando::Vector<galois::ELEdge> src_ev = reducedEL[src];
PANDO_CHECK(src_ev.append(&ev));
Expand Down

0 comments on commit 678ecdf

Please sign in to comment.