@@ -949,8 +949,7 @@ void perform_moves(const problem& prob, part_vt part, const vtx_vt swaps, const
949
949
// this whole mess avoids 2 stream-syncs on the 3 reductions in this function
950
950
// by combining their data movements to host together
951
951
int64_t cut_change = scratch.cut_change2 () + scratch.cut_change1 ();
952
- gain_t max_size = scratch.max_part ();
953
- curr_state.total_imb = max_size > prob.opt ? max_size - prob.opt : 0 ;
952
+ curr_state.total_imb = scratch.max_part ();
954
953
curr_state.cut -= cut_change;
955
954
}
956
955
@@ -1070,13 +1069,11 @@ void jet_refine(const matrix_t g, const config_t& config, wgt_vt vtx_w, part_vt
1070
1069
prob.size_max = prob.opt *imb_ratio;
1071
1070
if (!best_state.init ){
1072
1071
best_state.init = true ;
1073
- gain_t max_size = stat::largest_part_size (best_state.part_sizes );
1074
- best_state.total_imb = max_size > prob.opt ? max_size - prob.opt : 0 ;
1072
+ best_state.total_imb = stat::largest_part_size (best_state.part_sizes );
1075
1073
std::cout << " Initial " << std::fixed << (best_state.cut / 2 ) << " " << std::setprecision (6 ) << (static_cast <double >(best_state.total_imb ) / static_cast <double >(prob.opt )) << " " ;
1076
1074
std::cout << g.numRows () << std::endl;
1077
1075
}
1078
1076
refine_data curr_state = clone_refine_data (best_state);
1079
- gain_t imb_max = prob.size_max - prob.opt ;
1080
1077
part_vt part (Kokkos::ViewAllocateWithoutInitializing (" current partition" ), g.numRows ());
1081
1078
Kokkos::deep_copy (exec_space (), part, best_part);
1082
1079
conn_data cdata = init_conn_data (perm_cdata, g, part, k);
@@ -1104,7 +1101,7 @@ void jet_refine(const matrix_t g, const config_t& config, wgt_vt vtx_w, part_vt
1104
1101
while (count++ <= 11 ){
1105
1102
iter_count++;
1106
1103
vtx_vt moves;
1107
- if (curr_state.total_imb <= imb_max ){
1104
+ if (curr_state.total_imb <= prob. size_max ){
1108
1105
moves = jet_lp (prob, part, cdata, scratch, filter_ratio);
1109
1106
balance_counter = 0 ;
1110
1107
lab_counter++;
@@ -1118,11 +1115,11 @@ void jet_refine(const matrix_t g, const config_t& config, wgt_vt vtx_w, part_vt
1118
1115
}
1119
1116
perform_moves (prob, part, moves, scratch.dest_part , scratch, cdata, curr_state);
1120
1117
// copy current partition and relevant data to output partition if following conditions pass
1121
- if (best_state.total_imb > imb_max && curr_state.total_imb < best_state.total_imb ){
1118
+ if (best_state.total_imb > prob. size_max && curr_state.total_imb < best_state.total_imb ){
1122
1119
copy_refine_data (best_state, curr_state);
1123
1120
Kokkos::deep_copy (exec_space (), best_part, part);
1124
1121
count = 0 ;
1125
- } else if (curr_state.cut < best_state.cut && (curr_state.total_imb <= imb_max || curr_state.total_imb <= best_state.total_imb )){
1122
+ } else if (curr_state.cut < best_state.cut && (curr_state.total_imb <= prob. size_max || curr_state.total_imb <= best_state.total_imb )){
1126
1123
// do not reset counter if cut improvement is too small
1127
1124
if (curr_state.cut < tol*best_state.cut ){
1128
1125
count = 0 ;
0 commit comments