Skip to content

Commit

Permalink
[FM refactoring] perform fixed vertex check slightly deepter --> halv…
Browse files Browse the repository at this point in the history
…e compilation time
  • Loading branch information
larsgottesbueren committed Sep 4, 2023
1 parent 5b9bcfb commit 9b5fe74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions mt-kahypar/partition/refinement/fm/localized_kway_fm_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ namespace mt_kahypar {
deltaPhg.clear();
deltaPhg.setPartitionedHypergraph(&phg);
delta_gain_cache.clear();
if ( phg.hasFixedVertices() ) {
internalFindMoves<true>(phg, fm_strategy);
} else {
internalFindMoves<false>(phg, fm_strategy);
}
internalFindMoves(phg, fm_strategy);
return true;
} else {
return false;
Expand Down Expand Up @@ -113,7 +109,7 @@ namespace mt_kahypar {


template<typename TypeTraits, typename GainTypes>
template<bool has_fixed_vertices, typename DispatchedFMStrategy>
template<typename DispatchedFMStrategy>
void LocalizedKWayFM<TypeTraits, GainTypes>::internalFindMoves(PartitionedHypergraph& phg,
DispatchedFMStrategy& fm_strategy) {
StopRule stopRule(phg.initialNumNodes());
Expand Down Expand Up @@ -203,7 +199,12 @@ namespace mt_kahypar {
break;
}

acquireOrUpdateNeighbors<has_fixed_vertices>(deltaPhg, delta_gain_cache, move, fm_strategy);
if (phg.hasFixedVertices()) {
acquireOrUpdateNeighbors<true>(deltaPhg, delta_gain_cache, move, fm_strategy);
} else {
acquireOrUpdateNeighbors<false>(deltaPhg, delta_gain_cache, move, fm_strategy);
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class LocalizedKWayFM {
FMStats stats;

private:
template<bool has_fixed_vertices, typename DispatchedFMStrategy>
template<typename DispatchedFMStrategy>
void internalFindMoves(PartitionedHypergraph& phg, DispatchedFMStrategy& fm_strategy);

template<bool has_fixed_vertices, typename PHG, typename CACHE, typename DispatchedFMStrategy>
Expand Down

0 comments on commit 9b5fe74

Please sign in to comment.