Skip to content

Commit

Permalink
Fixed infinite loop bug in Subgraph isomorphism (#1672)
Browse files Browse the repository at this point in the history
* Experiment to address infinite loop

* Experiment #2 to address infinite loop

* Experiment #3 to address infinite loop

* Temporary debug output added

* External limit for number of threads was removed

* Experiment #4 to address infinite loop

* Experiment #5 to address infinite loop

* Experiment #6 to address infinite loop

* Experiment #7 to address infinite loop

* Experiment #8 to address infinite loop

* 20% is set as optimal value

* Temporary code removed

* Optimal array_size is caclulated based on max thread count

* Optimal array_size is decreased

* Optimal array_size is adjusted

* Optimal array_size is adjusted

* Optimal array_size is adjusted

* Optimal array_size is adjusted

* Optimal array_size is adjusted

* Optimal array_size is adjusted

* Optimal array_size is adjusted

* Experiment #9 to address infinite loop

* Optimal array_size is adjusted

* Temporary debug output added

* Compilation fix

* Experiment #10 to address infinite loop

* Temporary debug output added

* Experiment #11 to address infinite loop

* Temporary code removed

* Optimal array_size is adjusted
  • Loading branch information
Michael Averbukh authored Jun 3, 2021
1 parent 9b4f2b2 commit 658eb24
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,15 +457,18 @@ solution<Cpu> engine_bundle<Cpu>::run() {
std::uint64_t max_threads_count = dal::detail::threader_get_max_threads();
std::uint64_t possible_first_states_count_per_thread = first_states_count / max_threads_count;
if (possible_first_states_count_per_thread < 1) {
max_threads_count = first_states_count;
possible_first_states_count_per_thread = 1;
}
else {
possible_first_states_count_per_thread +=
static_cast<bool>(first_states_count % max_threads_count);
}

const std::uint64_t array_size = max_threads_count;
const std::uint64_t array_size = (max_threads_count >= 64) ? max_threads_count * 2 / 10
: (max_threads_count >= 24) ? max_threads_count * 4 / 10
: (max_threads_count >= 8) ? 4
: (max_threads_count >= 4) ? 2
: 1;
auto engine_array_ptr = allocator_.make_shared_memory<matching_engine<Cpu>>(array_size);
matching_engine<Cpu>* engine_array = engine_array_ptr.get();

Expand Down

0 comments on commit 658eb24

Please sign in to comment.