Skip to content

Commit 8d83557

Browse files
total_imb now tracks max part size, instead of max diff between part size and optimal size
1 parent 750e608 commit 8d83557

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/jet_refiner.hpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,7 @@ void perform_moves(const problem& prob, part_vt part, const vtx_vt swaps, const
949949
//this whole mess avoids 2 stream-syncs on the 3 reductions in this function
950950
//by combining their data movements to host together
951951
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();
954953
curr_state.cut -= cut_change;
955954
}
956955

@@ -1070,13 +1069,11 @@ void jet_refine(const matrix_t g, const config_t& config, wgt_vt vtx_w, part_vt
10701069
prob.size_max = prob.opt*imb_ratio;
10711070
if(!best_state.init){
10721071
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);
10751073
std::cout << "Initial " << std::fixed << (best_state.cut / 2) << " " << std::setprecision(6) << (static_cast<double>(best_state.total_imb) / static_cast<double>(prob.opt)) << " ";
10761074
std::cout << g.numRows() << std::endl;
10771075
}
10781076
refine_data curr_state = clone_refine_data(best_state);
1079-
gain_t imb_max = prob.size_max - prob.opt;
10801077
part_vt part(Kokkos::ViewAllocateWithoutInitializing("current partition"), g.numRows());
10811078
Kokkos::deep_copy(exec_space(), part, best_part);
10821079
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
11041101
while(count++ <= 11){
11051102
iter_count++;
11061103
vtx_vt moves;
1107-
if(curr_state.total_imb <= imb_max){
1104+
if(curr_state.total_imb <= prob.size_max){
11081105
moves = jet_lp(prob, part, cdata, scratch, filter_ratio);
11091106
balance_counter = 0;
11101107
lab_counter++;
@@ -1118,11 +1115,11 @@ void jet_refine(const matrix_t g, const config_t& config, wgt_vt vtx_w, part_vt
11181115
}
11191116
perform_moves(prob, part, moves, scratch.dest_part, scratch, cdata, curr_state);
11201117
//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){
11221119
copy_refine_data(best_state, curr_state);
11231120
Kokkos::deep_copy(exec_space(), best_part, part);
11241121
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)){
11261123
//do not reset counter if cut improvement is too small
11271124
if(curr_state.cut < tol*best_state.cut){
11281125
count = 0;

0 commit comments

Comments
 (0)