diff --git a/NEWS.md b/NEWS.md index 8cc2c55..458d214 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,7 @@ bssm 2.0.2 (Release date: 2023-10-18) * Removed explicit C++ version requirement as required by new CRAN policies. * Removed `magrittr` dependency and switched to native pipe, leading to requirement for R 4.1.0+. - * Added Sys.setenv("OMP_THREAD_LIMIT" = 2) to fix weird CRAN issues with + * Added Sys.setenv("OMP_NUM_THREADS" = 2) to fix weird CRAN issues with parallelisation on Debian. bssm 2.0.1 (Release date: 2022-05-02) diff --git a/R/approx.R b/R/approx.R index 8010682..0c6a940 100644 --- a/R/approx.R +++ b/R/approx.R @@ -31,7 +31,7 @@ #' @export #' @rdname gaussian_approx #' @examples -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' data("poisson_series") #' model <- bsm_ng(y = poisson_series, sd_slope = 0.01, sd_level = 0.1, #' distribution = "poisson") diff --git a/R/bssm-package.R b/R/bssm-package.R index fb0515d..27504a4 100644 --- a/R/bssm-package.R +++ b/R/bssm-package.R @@ -89,7 +89,7 @@ #' time ts ts.union tsp tsp<- sd na.omit #' @useDynLib bssm #' @examples -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' # Create a local level model (latent random walk + noise) to the Nile #' # dataset using the bsm_lg function: #' model <- bsm_lg(Nile, @@ -139,7 +139,7 @@ NULL #' \url{https://stat.fi/tup/tilastotietokannat/index_en.html}. #' @keywords datasets #' @examples -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' data("drownings") #' model <- bsm_ng(drownings[, "deaths"], u = drownings[, "population"], #' xreg = drownings[, "summer_temp"], distribution = "poisson", @@ -167,7 +167,7 @@ NULL #' Time Series Analysis by State Space Methods. Oxford University Press. #' https://doi.org/10.1093/acprof:oso/9780199641178.001.0001 #' @examples -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' data("exchange") #' model <- svm(exchange, rho = uniform(0.97,-0.999,0.999), #' sd_ar = halfnormal(0.175, 2), mu = normal(-0.87, 0, 2)) @@ -191,7 +191,7 @@ NULL #' Scand J Statist. 1-38. https://doi.org/10.1111/sjos.12492 #' #' @examples -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' # The data was generated as follows: #' set.seed(321) #' slope <- cumsum(c(0, rnorm(99, sd = 0.01))) @@ -245,7 +245,7 @@ NULL #' https://doi.org/10.32614/RJ-2021-103 #' #' @examples -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' # reproducing the model: #' data("negbin_series") #' # Construct model for bssm diff --git a/R/ekpf_filter.R b/R/ekpf_filter.R index 4c79e75..a348496 100644 --- a/R/ekpf_filter.R +++ b/R/ekpf_filter.R @@ -21,7 +21,7 @@ ekpf_filter <- function(model, particles, ...) { #' @rdname ekpf_filter #' @examples #' \donttest{ # Takes a while -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' set.seed(1) #' n <- 50 #' x <- y <- numeric(n) diff --git a/R/kfilter.R b/R/kfilter.R index 3ab258f..4316ec2 100644 --- a/R/kfilter.R +++ b/R/kfilter.R @@ -69,7 +69,7 @@ kfilter.nongaussian <- function(model, ...) { #' @export #' @examples #' \donttest{ # Takes a while on CRAN -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' set.seed(1) #' mu <- -0.2 #' rho <- 0.7 @@ -139,7 +139,7 @@ ekf <- function(model, iekf_iter = 0) { #' @export #' @examples #' \donttest{ # Takes a while on CRAN -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' set.seed(1) #' mu <- -0.2 #' rho <- 0.7 diff --git a/R/models.R b/R/models.R index fa0f6da..85c69f3 100644 --- a/R/models.R +++ b/R/models.R @@ -61,7 +61,7 @@ default_update_fn <- function(theta) { #' @return An object of class \code{ssm_ulg}. #' @export #' @examples -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' #' # Regression model with time-varying coefficients #' set.seed(1) diff --git a/R/post_correction.R b/R/post_correction.R index 813c785..7455fe6 100644 --- a/R/post_correction.R +++ b/R/post_correction.R @@ -174,7 +174,7 @@ suggest_N <- function(model, theta, #' @export #' @examples #' \donttest{ -#' Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +#' Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN #' set.seed(1) #' n <- 300 #' x1 <- sin((2 * pi / 12) * 1:n) diff --git a/man/bssm.Rd b/man/bssm.Rd index e578258..9aec216 100644 --- a/man/bssm.Rd +++ b/man/bssm.Rd @@ -64,7 +64,7 @@ statistics, and further diagnostics checks can be performed with the help of the \code{posterior} and \code{coda} packages. } \examples{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN # Create a local level model (latent random walk + noise) to the Nile # dataset using the bsm_lg function: model <- bsm_lg(Nile, diff --git a/man/drownings.Rd b/man/drownings.Rd index ebc26a1..cdfb618 100644 --- a/man/drownings.Rd +++ b/man/drownings.Rd @@ -19,7 +19,7 @@ unweighted average of three weather stations: Helsinki (Southern Finland), Jyvaskyla (Central Finland), and Sodankyla (Northern Finland). } \examples{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN data("drownings") model <- bsm_ng(drownings[, "deaths"], u = drownings[, "population"], xreg = drownings[, "summer_temp"], distribution = "poisson", diff --git a/man/ekf.Rd b/man/ekf.Rd index c215ed8..80142cd 100644 --- a/man/ekf.Rd +++ b/man/ekf.Rd @@ -27,7 +27,7 @@ states \eqn{\alpha_t} given the data up to time \eqn{t}. } \examples{ \donttest{ # Takes a while on CRAN -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN set.seed(1) mu <- -0.2 rho <- 0.7 diff --git a/man/ekpf_filter.Rd b/man/ekpf_filter.Rd index 8621763..7ff169f 100644 --- a/man/ekpf_filter.Rd +++ b/man/ekpf_filter.Rd @@ -37,7 +37,7 @@ with stratification resampling, based on Van Der Merwe et al (2001). } \examples{ \donttest{ # Takes a while -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN set.seed(1) n <- 50 x <- y <- numeric(n) diff --git a/man/exchange.Rd b/man/exchange.Rd index 6e02533..3e47d81 100644 --- a/man/exchange.Rd +++ b/man/exchange.Rd @@ -16,7 +16,7 @@ Dataset containing daily log-returns from 1/10/81-28/6/85 as in Durbin and Koopman (2012). } \examples{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN data("exchange") model <- svm(exchange, rho = uniform(0.97,-0.999,0.999), sd_ar = halfnormal(0.175, 2), mu = normal(-0.87, 0, 2)) diff --git a/man/gaussian_approx.Rd b/man/gaussian_approx.Rd index d762410..222cae8 100644 --- a/man/gaussian_approx.Rd +++ b/man/gaussian_approx.Rd @@ -43,7 +43,7 @@ This function is rarely needed itself, and is mainly available for testing and debugging purposes. } \examples{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN data("poisson_series") model <- bsm_ng(y = poisson_series, sd_slope = 0.01, sd_level = 0.1, distribution = "poisson") diff --git a/man/negbin_model.Rd b/man/negbin_model.Rd index f41c930..64abb17 100644 --- a/man/negbin_model.Rd +++ b/man/negbin_model.Rd @@ -13,7 +13,7 @@ iterations. Here only 2000 iterations were used in order to reduce the size of the model object in CRAN. } \examples{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN # reproducing the model: data("negbin_series") # Construct model for bssm diff --git a/man/poisson_series.Rd b/man/poisson_series.Rd index 3e20cc2..caa85da 100644 --- a/man/poisson_series.Rd +++ b/man/poisson_series.Rd @@ -12,7 +12,7 @@ See example for code for reproducing the data. This was used in Vihola, Helske, Franks (2020). } \examples{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN # The data was generated as follows: set.seed(321) slope <- cumsum(c(0, rnorm(99, sd = 0.01))) diff --git a/man/post_correct.Rd b/man/post_correct.Rd index ac7dad5..579be6a 100644 --- a/man/post_correct.Rd +++ b/man/post_correct.Rd @@ -52,7 +52,7 @@ weighted posterior, and returns updated MCMC output where components } \examples{ \donttest{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN set.seed(1) n <- 300 x1 <- sin((2 * pi / 12) * 1:n) diff --git a/man/ssm_ulg.Rd b/man/ssm_ulg.Rd index b6edba0..d590716 100644 --- a/man/ssm_ulg.Rd +++ b/man/ssm_ulg.Rd @@ -99,7 +99,7 @@ and then check the expected structure of the model components from the output. } \examples{ -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN # Regression model with time-varying coefficients set.seed(1) diff --git a/man/ukf.Rd b/man/ukf.Rd index 8c7b3d1..aa62875 100644 --- a/man/ukf.Rd +++ b/man/ukf.Rd @@ -32,7 +32,7 @@ states \eqn{\alpha_t} given the data up to time \eqn{t}. } \examples{ \donttest{ # Takes a while on CRAN -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN set.seed(1) mu <- -0.2 rho <- 0.7 diff --git a/tests/test_all.R b/tests/test_all.R index c2be8f2..e93928f 100644 --- a/tests/test_all.R +++ b/tests/test_all.R @@ -1,4 +1,4 @@ -Sys.setenv("OMP_THREAD_LIMIT" = 2) +Sys.setenv("OMP_NUM_THREADS" = 2) library("testthat") test_check("bssm") diff --git a/vignettes/bssm.Rmd b/vignettes/bssm.Rmd index 11eff8c..c14c068 100644 --- a/vignettes/bssm.Rmd +++ b/vignettes/bssm.Rmd @@ -14,7 +14,7 @@ vignette: | --- ```{r, echo = FALSE} -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version", diff --git a/vignettes/growth_model.Rmd b/vignettes/growth_model.Rmd index 218a375..2120303 100644 --- a/vignettes/growth_model.Rmd +++ b/vignettes/growth_model.Rmd @@ -14,7 +14,7 @@ vignette: | --- ```{r, echo = FALSE} -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version 1.12.3. These were not found. Older versions will not work.") diff --git a/vignettes/psi_pf.Rmd b/vignettes/psi_pf.Rmd index de5a61f..e5cfc46 100644 --- a/vignettes/psi_pf.Rmd +++ b/vignettes/psi_pf.Rmd @@ -16,7 +16,7 @@ bvignette: | ``` ```{r, echo = FALSE} -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version 1.12.3. These were not found. Older versions will not work.") diff --git a/vignettes/sde_model.Rmd b/vignettes/sde_model.Rmd index 86a5d03..2fd74d7 100644 --- a/vignettes/sde_model.Rmd +++ b/vignettes/sde_model.Rmd @@ -14,7 +14,7 @@ vignette: | --- ```{r, echo = FALSE} -Sys.setenv("OMP_THREAD_LIMIT" = 2) # For CRAN +Sys.setenv("OMP_NUM_THREADS" = 2) # For CRAN if (!requireNamespace("rmarkdown") || !rmarkdown::pandoc_available("1.12.3")) { warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version 1.12.3. These were not found. Older versions will not work.")