Skip to content

Commit fc41d61

Browse files
feat(partitioner): print mt-kahypar errors
1 parent ca8fac3 commit fc41d61

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/partitioner/PartitionerKahyparMT.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ namespace d4 {
3434
PartitionerKahyparMT::PartitionerKahyparMT(unsigned maxNodes, unsigned maxEdges,
3535
unsigned maxSumEdgeSize,
3636
std::ostream &out) {
37-
mt_kahypar_error_t error{};
38-
3937
m_pins = std::make_unique<mt_kahypar_hyperedge_id_t[]>(maxSumEdgeSize);
4038
m_xpins = std::make_unique<size_t[]>(maxEdges + 3);
4139
m_cwghts = std::make_unique<mt_kahypar_hyperedge_weight_t[]>(maxNodes + 3);
@@ -48,13 +46,17 @@ PartitionerKahyparMT::PartitionerKahyparMT(unsigned maxNodes, unsigned maxEdges,
4846
m_mapNodes.resize(maxNodes + 3, false);
4947
m_markedNodes.resize(maxNodes + 3, false);
5048

51-
mt_kahypar_context_t* context = mt_kahypar_context_from_preset(DEFAULT);
49+
context = mt_kahypar_context_from_preset(DEFAULT);
5250
mt_kahypar_set_partitioning_parameters(context, 2 /* number of blocks */,
5351
0.05 /* imbalance parameter */,
5452
CUT /* objective function */);
5553

56-
mt_kahypar_status_t status = mt_kahypar_set_context_parameter(context, VERBOSE, "0", &error);
57-
assert(status == SUCCESS);
54+
mt_kahypar_error_t error{};
55+
mt_kahypar_set_context_parameter(context, VERBOSE, "0", &error);
56+
if (error.status != SUCCESS) {
57+
std::cerr << error.msg << std::endl;
58+
std::exit(1);
59+
}
5860
} // constructor
5961

6062
/**
@@ -76,7 +78,6 @@ void PartitionerKahyparMT::initPartitioner(Config &config) {
7678
*/
7779
void PartitionerKahyparMT::computePartition(HyperGraph &hypergraph, Level level,
7880
std::vector<int> &partition) {
79-
mt_kahypar_error_t error{};
8081
std::vector<unsigned> elts;
8182

8283
// graph initialization and shift the hypergraph
@@ -115,8 +116,14 @@ void PartitionerKahyparMT::computePartition(HyperGraph &hypergraph, Level level,
115116
mt_kahypar_create_hypergraph(context, num_vertices, num_hyperedges,
116117
m_xpins.get(), m_pins.get(), cost, nullptr, &error);
117118

119+
mt_kahypar_error_t error{};
118120
auto p = mt_kahypar_partition(hgraph, context, &error);
119121

122+
if (error.status != SUCCESS) {
123+
std::cerr << error.msg << std::endl;
124+
std::exit(1);
125+
}
126+
120127
mt_kahypar_get_partition(p, m_partition.data());
121128

122129
mt_kahypar_free_hypergraph(hgraph);

0 commit comments

Comments
 (0)