Skip to content

Commit

Permalink
Revert "Faster computing of group_counts (no need to save memory here)."
Browse files Browse the repository at this point in the history
This reverts commit 7f353cb. The
optimizations did not end up working on large inputs.
  • Loading branch information
tmaklin committed Aug 17, 2024
1 parent 10e53f7 commit dba6b84
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/Likelihood.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,21 @@ class LL_WOR21 : public Likelihood<T> {
#endif

// This double loop is currently the slowest part in the input reading
std::vector<size_t> group_counts(num_ecs*n_groups, 0);
std::vector<bm::sparse_vector<V, bm::bvector<>>> local_counts(n_threads);
#pragma omp parallel for schedule(static)
for (size_t i = 0; i < num_ecs; ++i) {
for (size_t j = 0; j < n_targets; ++j) {
if (alignment(i, j)) {
++group_counts[alignment.get_groups()[j]*num_ecs + i];
local_counts[omp_get_thread_num()].inc(alignment.get_groups()[j]*num_ecs + i);
}
}
}

bm::sparse_vector<V, bm::bvector<>> group_counts = std::move(local_counts[0]);
for (size_t i = 1; i < n_threads; ++i) {
group_counts.merge(local_counts[i]);
}

bool mask_groups = min_hits > 0;
this->groups_mask = std::vector<bool>(n_groups, !mask_groups);
std::vector<V> masked_group_sizes;
Expand Down

0 comments on commit dba6b84

Please sign in to comment.