Skip to content

Commit

Permalink
Capped ncores at 2 because of reuse as nthreads argument in bam curre…
Browse files Browse the repository at this point in the history
…ntly
  • Loading branch information
michdn committed Aug 8, 2019
1 parent 05477a6 commit 051ae00
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/forecasting.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ run_forecast <- function(epi_data,
#used in anomalize_env() and forecast_regression()
if (!is.null(fc_control$ncores)) {
ncores <- fc_control$ncores
} else ncores <- max(parallel::detectCores(logical=FALSE) - 1, 1)
#because re-using ncores argument for nthreads &
# nthreads above 2 is not actually helpful
ncores <- ifelse(ncores > 1, 2, 1)
} else {
#no ncores value fed in, so test and determine
#cap at 2 for nthread re-use of this variable
#ncores <- max(parallel::detectCores(logical=FALSE) - 1, 1)
ncores <- ifelse(parallel::detectCores(logical=FALSE) > 1, 2, 1)
} #end else for ncores not given

# create the modeling variable
# epi_data <- mutate(epi_data, logcase = log(cases_epidemiar + 1))
Expand Down

0 comments on commit 051ae00

Please sign in to comment.