Skip to content

Commit

Permalink
#37 count_sizes returned pure 0s
Browse files Browse the repository at this point in the history
  • Loading branch information
carljohnsen committed Mar 23, 2024
1 parent b40749f commit 844df3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/cpp/cpu/connected_components.cc
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,13 @@ void count_sizes(int64_t *__restrict__ img, std::vector<int64_t> &sizes, const i
#pragma omp parallel
{
int64_t thread_id = omp_get_thread_num();
std::vector<int64_t> local_sizes = sizes_thread[thread_id];
std::vector<int64_t> local_sizes(n_labels+1, 0);

#pragma omp for
for (int64_t i = 0; i < size; i++) {
local_sizes[img[i]]++;
}
std::copy(local_sizes.begin(), local_sizes.end(), sizes_thread[thread_id].begin());

#pragma omp for
for (int64_t i = 0; i < n_labels+1; i++) {
Expand Down

0 comments on commit 844df3e

Please sign in to comment.