Fix OMP compilation (#824)

* Fix omp variable names
This commit is contained in:
Kenneth Heafield 2021-03-03 01:26:49 +00:00 committed by GitHub
parent d92b74f67a
commit af3aa314d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Correct training with fp16 via `--fp16`.
- Dynamic cost-scaling with `--cost-scaling`.
- Dynamic gradient-scaling with `--dynamic-gradient-scaling`.
- Fix compilation with OMP
### Fixed
- Find MKL installed under Ubuntu 20.04 via apt-get

View File

@ -914,13 +914,13 @@ void CrossEntropyPick(Tensor out, Tensor in, Tensor labelIndices, float labelSmo
}
float sumexp = 0.f;
#pragma omp simd reduction(+ : sum)
#pragma omp simd reduction(+ : sumexp)
for(int i = 0; i < cols; ++i) {
sumexp += std::exp(sp[i] - max);
}
float mean = 0.f;
#pragma omp simd reduction(+ : sum)
#pragma omp simd reduction(+ : mean)
for(int i = 0; i < cols; ++i) {
mean += sp[i] - max;
}