From 7dddf9674fae3220c51fdbe60b13770e5abf6f71 Mon Sep 17 00:00:00 2001 From: Matt Dancho Date: Sat, 2 Sep 2023 11:47:07 -0400 Subject: [PATCH] version 1.2.8 --- CRAN-SUBMISSION | 6 +++--- NEWS.md | 12 ++++++++++++ R/utils-control-par.R | 18 +++++++++--------- R/zzz.R | 4 ++++ man/control_modeltime.Rd | 16 ++++++++-------- tests/testthat/test-tune_workflows.R | 6 +++++- 6 files changed, 41 insertions(+), 21 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 615663c1..fcd3b5e6 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 1.2.4 -Date: 2022-11-15 17:20:40 UTC -SHA: f9d9a42f6d76fdbf91fa196909ad51c089af0715 +Version: 1.2.8 +Date: 2023-09-02 14:32:22 UTC +SHA: 0ab9dbfe2a0dd5eb00355315df20485537ed7b0b diff --git a/NEWS.md b/NEWS.md index 07099ba4..6988698d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,18 @@ - Integrate Conformal Predictions. #173 - New Vignette: Conformal Forecast Prediction Intervals in Modeltime + +#### Other Changes: + +- Reduced test times on CRAN +- CRAN Vignettes & Tests: Enforce no parallel cores `Sys.setenv("OMP_THREAD_LIMIT" = 1)` +- Change the default parallel processing to one (1) core from all available cores (-1): + - `control_refit()` + - `control_fit_workflowset()` + - `control_nested_fit()` + - `control_nested_refit()` + - `control_nested_forecast()` + # modeltime 1.2.7 - Fixes for R4.3+ which returns `lm` models as `pred_res`. #228 diff --git a/R/utils-control-par.R b/R/utils-control-par.R index 2fadea88..a4bff260 100644 --- a/R/utils-control-par.R +++ b/R/utils-control-par.R @@ -169,7 +169,7 @@ get_operator <- function(allow_par = TRUE) { #' #' @param allow_par Logical to allow parallel computation. Default: `FALSE` (single threaded). #' @param cores Number of cores for computation. If -1, uses all available physical cores. -#' Default: `-1`. +#' Default: `1`. #' @param packages An optional character string of additional R package names that should be loaded #' during parallel processing. #' @@ -192,8 +192,8 @@ get_operator <- function(allow_par = TRUE) { #' # No parallel processing by default #' control_refit() #' -#' # Allow parallel processing -#' control_refit(allow_par = TRUE) +#' # Allow parallel processing and use all cores +#' control_refit(allow_par = TRUE, cores = -1) #' #' # Set verbosity to show additional training information #' control_refit(verbose = TRUE) @@ -212,7 +212,7 @@ get_operator <- function(allow_par = TRUE) { #' @rdname control_modeltime control_refit <- function(verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL) { ret <- control_modeltime_objects( @@ -240,7 +240,7 @@ print.control_refit <- function(x, ...) { #' @rdname control_modeltime control_fit_workflowset <- function(verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL) { ret <- control_modeltime_objects( @@ -270,7 +270,7 @@ print.control_fit_workflowset <- function(x, ...) { #' @rdname control_modeltime control_nested_fit <- function(verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL) { ret <- control_modeltime_objects( @@ -301,7 +301,7 @@ print.control_nested_fit <- function(x, ...) { #' @rdname control_modeltime control_nested_refit <- function(verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL) { ret <- control_modeltime_objects( @@ -332,7 +332,7 @@ print.control_nested_refit <- function(x, ...) { #' @rdname control_modeltime control_nested_forecast <- function(verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL) { ret <- control_modeltime_objects( @@ -362,7 +362,7 @@ print.control_nested_refit <- function(x, ...) { control_modeltime_objects <- function( verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL, func = NULL ) { diff --git a/R/zzz.R b/R/zzz.R index c0a3a470..b194dc59 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -11,6 +11,10 @@ # been loaded. .onLoad <- function(libname, pkgname) { + + # CRAN OMP THREAD LIMIT + Sys.setenv("OMP_THREAD_LIMIT" = 1) + # This defines the model database # Prophet diff --git a/man/control_modeltime.Rd b/man/control_modeltime.Rd index ae8f86ef..70b6fc4e 100644 --- a/man/control_modeltime.Rd +++ b/man/control_modeltime.Rd @@ -9,33 +9,33 @@ \alias{control_nested_forecast} \title{Control aspects of the training process} \usage{ -control_refit(verbose = FALSE, allow_par = FALSE, cores = -1, packages = NULL) +control_refit(verbose = FALSE, allow_par = FALSE, cores = 1, packages = NULL) control_fit_workflowset( verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL ) control_nested_fit( verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL ) control_nested_refit( verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL ) control_nested_forecast( verbose = FALSE, allow_par = FALSE, - cores = -1, + cores = 1, packages = NULL ) } @@ -45,7 +45,7 @@ control_nested_forecast( \item{allow_par}{Logical to allow parallel computation. Default: \code{FALSE} (single threaded).} \item{cores}{Number of cores for computation. If -1, uses all available physical cores. -Default: \code{-1}.} +Default: \code{1}.} \item{packages}{An optional character string of additional R package names that should be loaded during parallel processing. @@ -73,8 +73,8 @@ training functions: # No parallel processing by default control_refit() -# Allow parallel processing -control_refit(allow_par = TRUE) +# Allow parallel processing and use all cores +control_refit(allow_par = TRUE, cores = -1) # Set verbosity to show additional training information control_refit(verbose = TRUE) diff --git a/tests/testthat/test-tune_workflows.R b/tests/testthat/test-tune_workflows.R index c6172d34..d5192bb0 100644 --- a/tests/testthat/test-tune_workflows.R +++ b/tests/testthat/test-tune_workflows.R @@ -56,7 +56,11 @@ test_that("Tuning, arima_boost", { resamples = resample_spec, grid = grid_spec, metrics = metric_set(mae, mape, smape, mase, rmse, rsq), - control = control_grid(verbose = FALSE, allow_par = TRUE) + control = control_grid( + verbose = FALSE, + allow_par = TRUE, + cores = 2 + ) )