Skip to content

Commit

Permalink
Add .onLoad to ensure that CRAN checks don't yuse more than 2 CPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAxthelm committed Oct 23, 2023
1 parent a7a26e6 commit a68a2b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions R/r2dii.analysis-package.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#' @keywords internal
"_PACKAGE"

.onLoad <- function(libname, pkgname) {
# CRAN OMP THREAD LIMIT
# logic for setting OMP_THREAD_LIMIT form https://stackoverflow.com/a/77323812
# check modified from testthat's on_cran function
if (!interactive() && isFALSE(as.logical(Sys.getenv("NOT_CRAN", "false")))) {
Sys.setenv("OMP_THREAD_LIMIT" = 2)
}
}

# The following block is used by usethis to automatically manage
# roxygen namespace tags. Modify with care!
## usethis namespace: start
Expand Down

0 comments on commit a68a2b6

Please sign in to comment.