[core] fix slow predict-caching with many classes (#3109)

* fix prediction caching inefficiency for multiclass

* silence some warnings

* redundant if

* workaround for R v3.4.3 bug; fixes #3081
This commit is contained in:
Vadim Khotilovich
2018-02-15 18:31:42 -06:00
committed by GitHub
parent cf19caa46a
commit 9ffe8596f2
5 changed files with 31 additions and 32 deletions

View File

@@ -56,7 +56,7 @@ class RegLossObj : public ObjFunction {
int nthread = omp_get_max_threads();
// Use a maximum of 8 threads
#pragma omp parallel for schedule(static) num_threads(std::min(8, nthread))
for (int i = 0; i < n - remainder; i += 8) {
for (omp_ulong i = 0; i < n - remainder; i += 8) {
avx::Float8 y(&info.labels[i]);
avx::Float8 p = Loss::PredTransform(avx::Float8(&preds[i]));
avx::Float8 w = info.weights.empty() ? avx::Float8(1.0f)