Skip to content

Commit 5995d3a

Browse files
evalFuture(): disable querying of availableCores() for now
1 parent f6ba839 commit 5995d3a

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future
2-
Version: 1.34.0-9208
2+
Version: 1.34.0-9209
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Imports:
55
digest,

R/backend_api-SequentialFutureBackend-class.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ launchFuture.SequentialFutureBackend <- function(backend, future, ...) {
2424
on.exit(mdebugf("launchFuture() for %s ... DONE", commaq(class(backend))))
2525
}
2626

27-
## Launch future
28-
future[["state"]] <- "running"
29-
3027
## Get future
3128
data <- getFutureData(future, debug = debug)
3229

@@ -36,8 +33,9 @@ launchFuture.SequentialFutureBackend <- function(backend, future, ...) {
3633
earlySignal <- backend[["earlySignal"]]
3734
if (!is.null(earlySignal)) future[["earlySignal"]] <- earlySignal
3835

36+
## Launch future
37+
future[["state"]] <- "running"
3938
future[["result"]] <- evalFuture(data)
40-
4139
future[["state"]] <- "finished"
4240

4341
if (debug) mdebugf("%s started (and completed)", class(future)[1])

R/backend_api-evalFuture.R

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -569,34 +569,36 @@ evalFuture <- function(
569569
if ("threads" %in% reset) {
570570
on.exit(setNumberOfThreads(old), add = TRUE)
571571
}
572-
}
572+
}
573573

574574

575575
## -----------------------------------------------------------------
576576
## Limit nested parallelization
577577
## -----------------------------------------------------------------
578+
...future.ncores <- NA_integer_
579+
578580
## (a) Identify default number of cores - ignoring plan settings
579581
## FIXME: Can the results here be memoized? Can the results be
580582
## precalculated and stored in the strategy stack? /HB 2025-02-17
581-
...future.ncores <- local({
582-
ans <- NA_integer_
583-
584-
options(parallelly.availableCores.fallback = 1L)
585-
## NOTE: availableCores() is expensive
586-
ncores <- availableCores(which = "all")
587-
ncores <- ncores[ncores != ncores["system"]]
588-
ncores <- ncores[setdiff(names(ncores), c("_R_CHECK_LIMIT_CORES_", "Bioconductor"))]
589-
n_ncores <- length(ncores)
590-
if (n_ncores > 0) {
591-
if (n_ncores > 1) {
592-
ncores <- ncores[setdiff(names(ncores), "fallback")]
593-
}
583+
if (FALSE) {
584+
...future.ncores <- local({
585+
ans <- NA_integer_
586+
options(parallelly.availableCores.fallback = 1L)
587+
## NOTE: availableCores() is expensive
588+
ncores <- availableCores(which = "all")
589+
ncores <- ncores[setdiff(names(ncores), c("system", "_R_CHECK_LIMIT_CORES_", "Bioconductor"))]
590+
n_ncores <- length(ncores)
594591
if (n_ncores > 0) {
595-
ans <- min(ncores, na.rm = TRUE)
592+
if (n_ncores > 1) {
593+
ncores <- ncores[setdiff(names(ncores), "fallback")]
594+
}
595+
if (n_ncores > 0) {
596+
ans <- min(ncores, na.rm = TRUE)
597+
}
596598
}
597-
}
598-
ans
599-
})
599+
ans
600+
})
601+
}
600602

601603
## Use the next-level-down ("popped") future strategy
602604
plan(strategiesR, .cleanup = FALSE, .init = FALSE)

0 commit comments

Comments
 (0)