This is an automated email from the ASF dual-hosted git repository.
akarbown pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 5dbba54 [BUGFIX] Fix CI slowdown issue after removing 3rdparty/openmp
(#20367)
5dbba54 is described below
commit 5dbba54812742f4d6f9d83b1f7bae88084b69d75
Author: bgawrych <[email protected]>
AuthorDate: Tue Jun 22 09:22:20 2021 +0200
[BUGFIX] Fix CI slowdown issue after removing 3rdparty/openmp (#20367)
* Fix CI slowdown issue after removing 3rdparty/openmp
* Fix sanity
---
src/operator/tensor/broadcast_reduce-inl.h | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/operator/tensor/broadcast_reduce-inl.h
b/src/operator/tensor/broadcast_reduce-inl.h
index 1907c02..13fadbf 100644
--- a/src/operator/tensor/broadcast_reduce-inl.h
+++ b/src/operator/tensor/broadcast_reduce-inl.h
@@ -360,10 +360,17 @@ void seq_reduce_compute(const size_t N, const size_t M,
const bool addto,
const Shape<ndim> sshape, const Shape<ndim> rshape,
const Shape<ndim> rstride) {
const int thread_count =
engine::OpenMP::Get()->GetRecommendedOMPThreadCount();
- #pragma omp parallel for num_threads(thread_count) if (N >= thread_count)
- for (index_t idx = 0; idx < static_cast<index_t>(N); ++idx) {
- seq_reduce_assign<Reducer, ndim, AType, DType, OType, OP, IndexOP>
- (idx, M, addto, big, small, bshape, sshape, rshape, rstride, N <
thread_count);
+ if (N >= thread_count) {
+ #pragma omp parallel for num_threads(thread_count)
+ for (index_t idx = 0; idx < static_cast<index_t>(N); ++idx) {
+ seq_reduce_assign<Reducer, ndim, AType, DType, OType, OP, IndexOP>
+ (idx, M, addto, big, small, bshape, sshape, rshape, rstride, false);
+ }
+ } else {
+ for (index_t idx = 0; idx < static_cast<index_t>(N); ++idx) {
+ seq_reduce_assign<Reducer, ndim, AType, DType, OType, OP, IndexOP>
+ (idx, M, addto, big, small, bshape, sshape, rshape, rstride, true);
+ }
}
}