Skip to content

83 compute external cost and internal cost globally#90

Merged
francosansone merged 31 commits intosb-graph-devfrom
83-compute-external-cost-and-internal-cost-globally
Aug 12, 2025
Merged

83 compute external cost and internal cost globally#90
francosansone merged 31 commits intosb-graph-devfrom
83-compute-external-cost-and-internal-cost-globally

Conversation

@francosansone
Copy link
Copy Markdown
Collaborator

@francosansone francosansone commented Jul 25, 2025

Many changes were done to avoid recomputing internal and external communication while refining partitions.

CommunicationCost class has three internal structures:

  • One for external edges by partition.
  • One for external edges by set piece.
  • One for internal edges by set piece.

Keep in mind that in the following examplesit will be compared multi-threading executions (the previous one) with single thread executions.

Execution time:

Model Initialization before (ms) Initialization now (ms) Partitioning before (ms) Partitioning now (ms)
air_conditioners_4_100000.json 7275 2 214.6426 1.556986
air_conditioners_4_1000000.json 7360 3 216.1812 1.984096
spl_neurons_1000000_10_100.json 10 2.3179 51455 2049.37

Examples changing the number of partitions for "air conditioners with controller" model with size 1000 and 4 sections.

Partitions Initialization before (ms) Initialization now (ms) Partitioning before (ms) Partitioning now (ms)
4 4 1.8547 9580 215.5768
8 4 2.5772 40387 1035.622
16 3.1 1.6781 167404 2450.49
32 3.3 1.9695 639270 10177.73

Results changing the amount of connections between nodes for spl neurons model:

Connections Initialization (ms) Partitioning (ms)
10 2.515 2071.192
20 4.201 3603.624
50 9.421 12565.36
100 28.34 28694.72

Comment thread algorithms/partitioner/time_profiler.hpp
Comment thread algorithms/partitioner/partition_graph.hpp Outdated
Comment thread algorithms/partitioner/partition_strategy.hpp
Comment thread algorithms/partitioner/communication_cost.hpp Outdated
Comment thread algorithms/partitioner/communication_cost.hpp Outdated
Comment thread algorithms/partitioner/communication_cost.hpp Outdated
Comment thread algorithms/partitioner/kernighan_lin_partitioner.hpp Outdated
Comment thread algorithms/partitioner/kernighan_lin_partitioner.cpp
Comment thread algorithms/partitioner/kernighan_lin_partitioner.cpp Outdated
auto s1 = PartitionStrategyDistributive(number_of_partitions, graph, set_fact);
auto s1 = PartitionStrategyDistributive(number_of_partitions, graph);
add_strategy(s1, pre_order);
#if TRY_MULTIPLE_STRATEGIES
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: Not for this PR, but I would probably add an option to try multiple strategies instead of a compilation flag.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

New ticket created #93.

/// @param node set of nodes we want to know its connections.
/// @return a set of nodes connected to the function parameter.
SBG::LIB::Set get_adjacents(const SBG::LIB::SBG& graph, const SBG::LIB::Set& node, SBG::LIB::SetAF& set_fact, SBG::LIB::MapAF& map_fact);
SBG::LIB::Set get_adjacents(const SBG::LIB::SBG& graph, const SBG::LIB::Set& node);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe for another PR, but I guess we can modify:

SBG::LIB::WeightedSBGraph build_sb_graph(const std::string& filename, SBG::LIB::SetAF& set_fact,
    SBG::LIB::MapAF& map_fact, SBG::LIB::PWMapAF& pw_map_fact);

to be:

SBG::LIB::WeightedSBGraph build_sb_graph(const std::string& filename,  SBG::LIB::PWMapAF& pw_map_fact);

and access the map and set factories using SBG::LIB::PWMapAF& just to simplify the interfaces.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in the last commit.

@francosansone francosansone merged commit 47e2d76 into sb-graph-dev Aug 12, 2025
2 checks passed
@francosansone francosansone deleted the 83-compute-external-cost-and-internal-cost-globally branch August 12, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compute External Cost and Internal Cost globally

3 participants