diff options
author | huangjq0617 <huangjq0617@users.noreply.github.com> | 2021-04-11 07:28:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-11 07:28:04 +0300 |
commit | a7c3a0b2ef0d3a9ffd952bb1eb97e680633d1515 (patch) | |
tree | eec4a710ea12fb6478e7e50490907e9eb4a61cce | |
parent | fdf9fe7d4a98268b5d451bc5b5944da959fbe8e2 (diff) |
fix beam_search ABORT when enable openmp and OMP_NUM_THREADS > 1 (#767)
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rwxr-xr-x | src/tensors/cpu/tensor_operators.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9182057c..526d93d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added a few missing header files in shortlist.h and beam_search.h. - Improved handling for receiving SIGTERM during training. By default, SIGTERM triggers 'save (now) and exit'. Prior to this fix, batch pre-fetching did not check for this sigal, potentially delaying exit considerably. It now pays attention to that. Also, the default behaviour of save-and-exit can now be disabled on the command line with --sigterm exit-immediately. - Fix the runtime failures for FASTOPT on 32-bit builds (wasm just happens to be 32-bit) because it uses hashing with an inconsistent mix of uint64_t and size_t. +- fix beam_search ABORT_IF(beamHypIdx >= beam.size(), "Out of bounds beamHypIdx??"); when enable openmp and OMP_NUM_THREADS > 1 ### Changed - Remove `--clip-gemm` which is obsolete and was never used anyway diff --git a/src/tensors/cpu/tensor_operators.cpp b/src/tensors/cpu/tensor_operators.cpp index 1191a2be..d92adba8 100755 --- a/src/tensors/cpu/tensor_operators.cpp +++ b/src/tensors/cpu/tensor_operators.cpp @@ -261,12 +261,12 @@ void TransposeFirst3In4(Tensor out, Tensor in, const std::vector<int>& vAxis) { // find the mapping between the transposed output dimensional indices (oi, oj, ok) // and original input dimensional indices (i, j, k) - int oi, oj, ok; #pragma omp parallel for for(int k = 0; k < l1; ++k) { int shift = k * l2 * l3; for(int j = 0; j < l2; ++j) { for(int i = 0; i < l3; ++i) { + int oi, oj, ok; if(vAxis[0] == 0) { if(vAxis[1] == 1) { oi = i; oj = j; ok = k; |