Skip to content

Commit

Permalink
Export namespace and LC_TIME to parallel process
Browse files Browse the repository at this point in the history
This is part of addressing #1048 and complements PR #1049 but I am adding this in PR #1028 because of all the changes to part 6 in this PR.
  • Loading branch information
vincentvanhees committed Feb 21, 2024
1 parent 68a4c99 commit 16b97f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/g.part6.R
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ g.part6 = function(datadir = c(), metadatadir = c(), f0 = c(), f1 = c(),
Ncores2use = min(c(Ncores - 1, params_general[["maxNcores"]], (f1 - f0) + 1))
if (Ncores2use > 1) {
cl <- parallel::makeCluster(Ncores2use) # not to overload your computer
parallel::clusterExport(cl = cl,
varlist = c(unclass(lsf.str(envir = asNamespace("GGIR"), all = T)),
"MONITOR", "FORMAT"),
envir = as.environment(asNamespace("GGIR"))
)
parallel::clusterEvalQ(cl, Sys.setlocale("LC_TIME", "C"))
doParallel::registerDoParallel(cl)
} else {
# Don't process in parallel if only one core
Expand Down

0 comments on commit 16b97f0

Please sign in to comment.