Skip to content

Commit

Permalink
Added ifdef _OPENMP as the cpu_seq couldn't import since it hasn't be…
Browse files Browse the repository at this point in the history
…en compiled with openmp
  • Loading branch information
carljohnsen committed Oct 8, 2024
1 parent 1c336b5 commit f9a8d23
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/cpp/include/general.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace NS {
const T *src_data = src.data;
U *dst_data = dst.data;

#ifdef _OPENMP
U *local_dsts[omp_get_max_threads()];

#pragma omp parallel
Expand All @@ -55,6 +56,11 @@ namespace NS {
for (int64_t i = 0; i < omp_get_max_threads(); i++) {
free(local_dsts[i]);
}
#else
for (int64_t flat_index = 0; flat_index < src_length; flat_index++) {
dst_data[src_data[flat_index]]++;
}
#endif
}

/**
Expand Down

0 comments on commit f9a8d23

Please sign in to comment.