Created
May 7, 2020 23:20
-
-
Save DavisVaughan/8c312948b2c5943662312017ab54357e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn <- function() { | |
FUN <- function(x) { | |
data.table::getDTthreads() | |
} | |
parallel::mclapply(1:2, FUN, mc.cores = 2) | |
} | |
# Call `getDTthreads()` from the workers | |
# Should return 1 because we forked | |
fn() | |
# Now start it up in a separate process, | |
# then do the mclapply call which creates | |
# two workers to run getDTthreads() in. | |
# The two workers should be forks of the process, so | |
# why is this 6? | |
callr::r(fn) |
See ?getDTthreads
for documentation about data.table switching to use 1 thread in forked workers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result when run in rstudio, locally, one line at a time. Not using reprex here because it runs everything in a separate R session