Skip to content

Commit

Permalink
Merge pull request #58 from bibrakc/40-performance-of-pruning
Browse files Browse the repository at this point in the history
40 performance of pruning
  • Loading branch information
bibrakc authored Apr 16, 2024
2 parents 4ca7681 + 211da77 commit 0d6b6b9
Show file tree
Hide file tree
Showing 14 changed files with 193 additions and 68 deletions.
15 changes: 9 additions & 6 deletions Applications/Breadth_First_Search/cca_bfs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ configure_parser(cli::Parser& parser)
0,
"Randomly shuffle the vertex list so as to avoid any pattern in the graph based on vertex "
"IDs. This appears to be the case for certain RMAT graphs.");

parser.set_optional<u_int32_t>("trail", "trail_number", 0, "Trail number for this experiment.");
}

struct BFSCommandLineArguments
Expand Down Expand Up @@ -362,6 +364,10 @@ struct BFSCommandLineArguments
// To shuffle or to not shuffle the vertex ID list.
bool shuffle_switch{};

// Trail #. Used for taking multiple samples of the same configuations. Then can be averaged
// out.
u_int32_t trail_number{};

BFSCommandLineArguments(cli::Parser& parser)
: root_vertex(parser.get<u_int32_t>("root"))
, verify_results(parser.get<bool>("verify"))
Expand All @@ -378,6 +384,7 @@ struct BFSCommandLineArguments
, mesh_type(parser.get<u_int32_t>("mesh"))
, routing_policy(parser.get<u_int32_t>("route"))
, shuffle_switch(parser.get<bool>("shuffle"))
, trail_number(parser.get<u_int32_t>("trail"))
{

if (hdepth != 0) {
Expand Down Expand Up @@ -482,11 +489,6 @@ verify_results(const BFSCommandLineArguments& cmd_args,
}
}

// ANSI escape codes for color manipulation
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_RESET "\x1b[0m"

if (total_errors > 0) {
std::cout << ANSI_COLOR_RED << "Total number values error: " << total_errors
<< ", Verification Failed\n"
Expand All @@ -508,7 +510,8 @@ write_results(const BFSCommandLineArguments& cmd_args,

std::string const output_file_name =
"bfs_graph_" + cmd_args.graph_name + "_v_" + std::to_string(input_graph.total_vertices) +
"_e_" + std::to_string(input_graph.total_edges) + cca_simulator.key_configurations_string();
"_e_" + std::to_string(input_graph.total_edges) + "_trail_" +
std::to_string(cmd_args.trail_number) + cca_simulator.key_configurations_string();

std::string const output_file_path = cmd_args.output_file_directory + "/" + output_file_name;
std::cout << "\nWriting results to output file: " << output_file_path << "\n";
Expand Down
10 changes: 9 additions & 1 deletion Applications/Breadth_First_Search_Rhizome/cca_bfs_rhizome.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ configure_parser(cli::Parser& parser)
0,
"Randomly shuffle the vertex list so as to avoid any pattern in the graph based on vertex "
"IDs. This appears to be the case for certain RMAT graphs.");

parser.set_optional<u_int32_t>("trail", "trail_number", 0, "Trail number for this experiment.");
}

struct BFSCommandLineArguments
Expand Down Expand Up @@ -371,6 +373,10 @@ struct BFSCommandLineArguments
// To shuffle or to not shuffle the vertex ID list.
bool shuffle_switch{};

// Trail #. Used for taking multiple samples of the same configuations. Then can be averaged
// out.
u_int32_t trail_number{};

BFSCommandLineArguments(cli::Parser& parser)
: root_vertex(parser.get<u_int32_t>("root"))
, verify_results(parser.get<bool>("verify"))
Expand All @@ -387,6 +393,7 @@ struct BFSCommandLineArguments
, mesh_type(parser.get<u_int32_t>("mesh"))
, routing_policy(parser.get<u_int32_t>("route"))
, shuffle_switch(parser.get<bool>("shuffle"))
, trail_number(parser.get<u_int32_t>("trail"))
{

if (hdepth != 0) {
Expand Down Expand Up @@ -513,7 +520,8 @@ write_results(const BFSCommandLineArguments& cmd_args,
"bfs_graph_" + cmd_args.graph_name + "_v_" + std::to_string(input_graph.total_vertices) +
"_e_" + std::to_string(input_graph.total_edges) + "_rhizomes_" +
std::to_string(rhizome_size) + "_rhizomecutoff_" +
std::to_string(rhizome_inbound_degree_cutoff) + cca_simulator.key_configurations_string();
std::to_string(rhizome_inbound_degree_cutoff) + "_trail_" +
std::to_string(cmd_args.trail_number) + cca_simulator.key_configurations_string();

std::string const output_file_path = cmd_args.output_file_directory + "/" + output_file_name;
std::cout << "\nWriting results to output file: " << output_file_path << "\n";
Expand Down
10 changes: 9 additions & 1 deletion Applications/Dynamic_Breadth_First_Search/cca_dynamic_bfs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ configure_parser(cli::Parser& parser)
0,
"Randomly shuffle the vertex list so as to avoid any pattern in the graph based on vertex "
"IDs. This appears to be the case for certain RMAT graphs.");

parser.set_optional<u_int32_t>("trail", "trail_number", 0, "Trail number for this experiment.");
}

struct BFSCommandLineArguments
Expand Down Expand Up @@ -442,6 +444,10 @@ struct BFSCommandLineArguments
// To shuffle or to not shuffle the vertex ID list.
bool shuffle_switch{};

// Trail #. Used for taking multiple samples of the same configuations. Then can be averaged
// out.
u_int32_t trail_number{};

BFSCommandLineArguments(cli::Parser& parser)
: root_vertex(parser.get<u_int32_t>("root"))
, verify_results(parser.get<bool>("verify"))
Expand All @@ -459,6 +465,7 @@ struct BFSCommandLineArguments
, routing_policy(parser.get<u_int32_t>("route"))
, shuffle_switch(parser.get<bool>("shuffle"))
, increments(parser.get<u_int32_t>("increments"))
, trail_number(parser.get<u_int32_t>("trail"))
{

if (hdepth != 0) {
Expand Down Expand Up @@ -587,7 +594,8 @@ write_results(const BFSCommandLineArguments& cmd_args,

std::string const output_file_name = "dynamic_bfs_graph_" + cmd_args.graph_name + "_v_" +
std::to_string(input_graph.total_vertices) + "_e_" +
std::to_string(input_graph.total_edges) +
std::to_string(input_graph.total_edges) + "_trail_" +
std::to_string(cmd_args.trail_number) +
cca_simulator.key_configurations_string();

std::string const output_file_path = cmd_args.output_file_directory + "/" + output_file_name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ configure_parser(cli::Parser& parser)
0,
"Randomly shuffle the vertex list so as to avoid any pattern in the graph based on vertex "
"IDs. This appears to be the case for certain RMAT graphs.");

parser.set_optional<u_int32_t>("trail", "trail_number", 0, "Trail number for this experiment.");
}

struct PageRankFixedIterationsCommandLineArguments
Expand Down Expand Up @@ -425,6 +427,10 @@ struct PageRankFixedIterationsCommandLineArguments
// To shuffle or to not shuffle the vertex ID list.
bool shuffle_switch{};

// Trail #. Used for taking multiple samples of the same configuations. Then can be averaged
// out.
u_int32_t trail_number{};

PageRankFixedIterationsCommandLineArguments(cli::Parser& parser)
: root_vertex(parser.get<u_int32_t>("root"))
, iter(parser.get<u_int32_t>("iter"))
Expand All @@ -442,6 +448,7 @@ struct PageRankFixedIterationsCommandLineArguments
, mesh_type(parser.get<u_int32_t>("mesh"))
, routing_policy(parser.get<u_int32_t>("route"))
, shuffle_switch(parser.get<bool>("shuffle"))
, trail_number(parser.get<u_int32_t>("trail"))
{

if (hdepth != 0) {
Expand Down Expand Up @@ -550,7 +557,8 @@ write_results(const PageRankFixedIterationsCommandLineArguments& cmd_args,

std::string const output_file_name = "pagerank_graph_" + cmd_args.graph_name + "_v_" +
std::to_string(input_graph.total_vertices) + "_e_" +
std::to_string(input_graph.total_edges) +
std::to_string(input_graph.total_edges) + "_trail_" +
std::to_string(cmd_args.trail_number) +
cca_simulator.key_configurations_string();

std::string const output_file_path = cmd_args.output_file_directory + "/" + output_file_name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ page_rank_fixed_iterations_work_T(ComputeCell& cc,
}

// Reset.
// TODO: This needs to be all_reduced before being set.!!!
// This needs to be all_reduced before being set.!!!
if (v->current_iteration_incoming_count == v->inbound_degree) {

// rhizome_collapse(CCA_PLUS_OP, v->page_rank_current_rank_score, lambda);
Expand Down Expand Up @@ -267,6 +267,8 @@ page_rank_fixed_iterations_work_T(ComputeCell& cc,
if (!cc.insert_action(rhizome_collapse_page_rank, false)) {
std::cerr << "rhizome collapse can not be inserted in action queue!" << std::endl;
exit(0);
} else {
cc.statistics.actions_created++;
}
}

Expand Down Expand Up @@ -511,6 +513,8 @@ configure_parser(cli::Parser& parser)
0,
"Randomly shuffle the vertex list so as to avoid any pattern in the graph based on vertex "
"IDs. This appears to be the case for certain RMAT graphs.");

parser.set_optional<u_int32_t>("trail", "trail_number", 0, "Trail number for this experiment.");
}

struct PageRankFixedIterationsCommandLineArguments
Expand Down Expand Up @@ -553,6 +557,10 @@ struct PageRankFixedIterationsCommandLineArguments
// To shuffle or to not shuffle the vertex ID list.
bool shuffle_switch{};

// Trail #. Used for taking multiple samples of the same configuations. Then can be averaged
// out.
u_int32_t trail_number{};

PageRankFixedIterationsCommandLineArguments(cli::Parser& parser)
: root_vertex(parser.get<u_int32_t>("root"))
, iter(parser.get<u_int32_t>("iter"))
Expand All @@ -570,6 +578,7 @@ struct PageRankFixedIterationsCommandLineArguments
, mesh_type(parser.get<u_int32_t>("mesh"))
, routing_policy(parser.get<u_int32_t>("route"))
, shuffle_switch(parser.get<bool>("shuffle"))
, trail_number(parser.get<u_int32_t>("trail"))
{

if (hdepth != 0) {
Expand Down Expand Up @@ -676,12 +685,12 @@ write_results(const PageRankFixedIterationsCommandLineArguments& cmd_args,
CCASimulator& cca_simulator)
{

std::string const output_file_name = "pagerank_graph_" + cmd_args.graph_name + "_v_" +
std::to_string(input_graph.total_vertices) + "_e_" +
std::to_string(input_graph.total_edges) + "_rhizomes_" +
std::to_string(rhizome_size) + "_rhizomecutoff_" +
std::to_string(rhizome_inbound_degree_cutoff) +
cca_simulator.key_configurations_string();
std::string const output_file_name =
"pagerank_graph_" + cmd_args.graph_name + "_v_" +
std::to_string(input_graph.total_vertices) + "_e_" +
std::to_string(input_graph.total_edges) + "_rhizomes_" + std::to_string(rhizome_size) +
"_rhizomecutoff_" + std::to_string(rhizome_inbound_degree_cutoff) + "_trail_" +
std::to_string(cmd_args.trail_number) + cca_simulator.key_configurations_string();

std::string const output_file_path = cmd_args.output_file_directory + "/" + output_file_name;
std::cout << "\nWriting results to output file: " << output_file_path << "\n";
Expand Down
10 changes: 9 additions & 1 deletion Applications/Single_Source_Shortest_Path/cca_sssp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ configure_parser(cli::Parser& parser)
0,
"Randomly shuffle the vertex list so as to avoid any pattern in the graph based on vertex "
"IDs. This appears to be the case for certain RMAT graphs.");

parser.set_optional<u_int32_t>("trail", "trail_number", 0, "Trail number for this experiment.");
}

struct SSSPCommandLineArguments
Expand Down Expand Up @@ -357,6 +359,10 @@ struct SSSPCommandLineArguments
// To shuffle or to not shuffle the vertex ID list.
bool shuffle_switch{};

// Trail #. Used for taking multiple samples of the same configuations. Then can be averaged
// out.
u_int32_t trail_number{};

SSSPCommandLineArguments(cli::Parser& parser)
: root_vertex(parser.get<u_int32_t>("root"))
, verify_results(parser.get<bool>("verify"))
Expand All @@ -373,6 +379,7 @@ struct SSSPCommandLineArguments
, mesh_type(parser.get<u_int32_t>("mesh"))
, routing_policy(parser.get<u_int32_t>("route"))
, shuffle_switch(parser.get<bool>("shuffle"))
, trail_number(parser.get<u_int32_t>("trail"))
{

if (hdepth != 0) {
Expand Down Expand Up @@ -499,7 +506,8 @@ write_results(const SSSPCommandLineArguments& cmd_args,

std::string const output_file_name =
"sssp_graph_" + cmd_args.graph_name + "_v_" + std::to_string(input_graph.total_vertices) +
"_e_" + std::to_string(input_graph.total_edges) + cca_simulator.key_configurations_string();
"_e_" + std::to_string(input_graph.total_edges) + "_trail_" +
std::to_string(cmd_args.trail_number) + cca_simulator.key_configurations_string();

std::string const output_file_path = cmd_args.output_file_directory + "/" + output_file_name;
std::cout << "\nWriting results to output file: " << output_file_path << "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ configure_parser(cli::Parser& parser)
0,
"Randomly shuffle the vertex list so as to avoid any pattern in the graph based on vertex "
"IDs. This appears to be the case for certain RMAT graphs.");

parser.set_optional<u_int32_t>("trail", "trail_number", 0, "Trail number for this experiment.");
}

struct SSSPCommandLineArguments
Expand Down Expand Up @@ -375,6 +377,10 @@ struct SSSPCommandLineArguments
// To shuffle or to not shuffle the vertex ID list.
bool shuffle_switch{};

// Trail #. Used for taking multiple samples of the same configuations. Then can be averaged
// out.
u_int32_t trail_number{};

SSSPCommandLineArguments(cli::Parser& parser)
: root_vertex(parser.get<u_int32_t>("root"))
, verify_results(parser.get<bool>("verify"))
Expand All @@ -391,6 +397,7 @@ struct SSSPCommandLineArguments
, mesh_type(parser.get<u_int32_t>("mesh"))
, routing_policy(parser.get<u_int32_t>("route"))
, shuffle_switch(parser.get<bool>("shuffle"))
, trail_number(parser.get<u_int32_t>("trail"))
{

if (hdepth != 0) {
Expand Down Expand Up @@ -519,7 +526,8 @@ write_results(const SSSPCommandLineArguments& cmd_args,
"sssp_graph_" + cmd_args.graph_name + "_v_" + std::to_string(input_graph.total_vertices) +
"_e_" + std::to_string(input_graph.total_edges) + "_rhizomes_" +
std::to_string(rhizome_size) + "_rhizomecutoff_" +
std::to_string(rhizome_inbound_degree_cutoff) + cca_simulator.key_configurations_string();
std::to_string(rhizome_inbound_degree_cutoff) + "_trail_" +
std::to_string(cmd_args.trail_number) + cca_simulator.key_configurations_string();

std::string const output_file_path = cmd_args.output_file_directory + "/" + output_file_name;
std::cout << "\nWriting results to output file: " << output_file_path << "\n";
Expand Down
35 changes: 24 additions & 11 deletions Include/CCASimulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,22 +221,32 @@ class CCASimulator

os << "\nCCA Chip Details:\n\tShape: "
<< ComputeCell::get_compute_cell_shape_name(this->shape_of_compute_cells)
<< "\n\tDim: " << this->dim_x << " x " << this->dim_y
<< "\n\tHtree End Node Coverage Block: " << this->hx << " x " << this->hy
<< "\n\tHtree Depth: " << this->hdepth
<< "\n\tHtree Possible Bandwidth Max: " << this->hbandwidth_max
<< "\n\tTotal Cells: " << this->total_compute_cells
<< "\n\tTotal Compute Cells: " << this->total_compute_cells - this->total_sink_cells
<< "\n\tTotal Sink Cells: " << this->total_sink_cells
<< "\n\tSink/Compute Ratio (%): " << ratio_sink_compute
<< "\n\tMemory Per Compute Cell: " << this->memory_per_cc / static_cast<double>(1024)
<< "\n\tDim: " << this->dim_x << " x " << this->dim_y;

if (this->hdepth == 0) {
os << "\n\tTotal Compute Cells: " << this->total_compute_cells;
} else {
os << "\n\tTotal Cells: " << this->total_compute_cells;
}

os << "\n\tMemory Per Compute Cell: " << this->memory_per_cc / static_cast<double>(1024)
<< " KB"
<< "\n\tTotal Chip Memory: "
<< static_cast<double>(this->total_chip_memory / static_cast<double>(1024 * 1024))
<< " MB"
<< "\n\tMesh Type: " << this->primary_network_type
<< "\n\tRouting Policy: " << this->mesh_routing_policy_id << "\n"
<< std::endl;
<< "\n\tRouting Policy: " << this->mesh_routing_policy_id << "\n";

if (this->hdepth != 0) {

os << "\n\tHtree End Node Coverage Block: " << this->hx << " x " << this->hy
<< "\n\tHtree Depth: " << this->hdepth
<< "\n\tHtree Possible Bandwidth Max: " << this->hbandwidth_max
<< "\n\tTotal Compute Cells: " << this->total_compute_cells - this->total_sink_cells
<< "\n\tTotal Sink Cells: " << this->total_sink_cells
<< "\n\tSink/Compute Ratio (%): " << ratio_sink_compute << "\n"
<< std::endl;
}
}
inline void output_description_in_a_single_line(std::ostream& os)
{
Expand Down Expand Up @@ -264,6 +274,8 @@ class CCASimulator
}

os << "queues_configuration\n" << queues_text << "\n";

os << "ghost_children_max\n" << ghost_children_max << "\n";
}

inline void output_CCA_active_status_per_cycle(std::ostream& os)
Expand All @@ -287,6 +299,7 @@ class CCASimulator
<< "\t" << this->cca_statistics.active_status[i].htree_active_percent << "\n";
}
} else {
// Invalid values just to preserve format.
os << "0\t0\t0\n";
os << "0\t0\t0\n";
os << "0\t0\t0\n";
Expand Down
Loading

0 comments on commit 0d6b6b9

Please sign in to comment.