Skip to content

Commit 9197461

Browse files
committed
extra check and comments
1 parent c8cf0a7 commit 9197461

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/froll.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ void frollfun(rollfun_t rfun, unsigned int algo, const double *x, uint64_t nx, a
7979
if (algo==0) {
8080
frollvarFast(x, nx, ans, k, fill, narm, hasnf, verbose, par); // par is used only when NAs - fallback to exact, to know if outer parallelism has been applied
8181
} else if (algo==1) {
82-
frollvarExact(x, nx, ans, k, fill, narm, hasnf, verbose, /*par=*/ true); // par=true because frollvarExact at this place was invoked directly, and not by fallback, so algo=exact have been used explicitly, then outer parallelism in frollR.c is disabled already
82+
if (!par) // par should be true because frollvarExact at this place was invoked directly, and not by fallback, so algo=exact have been used explicitly, then outer parallelism in frollR.c is disabled already
83+
internal_error(__func__, "par=FALSE but should be TRUE, algo=exact should have disabled outer parallelism for vectorized input so frollvarExact should be allowed to go parallel"); // # nocov
84+
frollvarExact(x, nx, ans, k, fill, narm, hasnf, verbose, par);
8385
}
8486
break;
8587
case SD :
@@ -1331,7 +1333,7 @@ void frollsdFast(const double *x, uint64_t nx, ans_t *ans, int k, double fill, b
13311333
void frollsdExact(const double *x, uint64_t nx, ans_t *ans, int k, double fill, bool narm, int hasnf, bool verbose) {
13321334
if (verbose)
13331335
snprintf(end(ans->message[0]), 500, _("%s: calling sqrt(frollvarExact(...))\n"), "frollsdExact");
1334-
frollvarExact(x, nx, ans, k, fill, narm, hasnf, verbose, /*par=*/ true); // par=true because frollsdExact at this place was invoked directly, and not by fallback, so algo=exact have been used explicitly, then outer parallelism in frollR.c is disabled already
1336+
frollvarExact(x, nx, ans, k, fill, narm, hasnf, verbose, /*par=*/true); // par=true because frollsdExact at this place was invoked directly, and not by fallback, so algo=exact have been used explicitly, then outer parallelism in frollR.c is disabled already. If it would be algo=fast then sdFast -> varFast -> NAs -> varExact, so sdExact is no emplyed in the process, nothing redirects to sdExact
13351337
for (uint64_t i=k-1; i<nx; i++) {
13361338
ans->dbl_v[i] = sqrt(ans->dbl_v[i]);
13371339
}

0 commit comments

Comments
 (0)