0

I'm trying to speed up computation times associated with the raup-crick dissimilarity as calculated by Chase et al. 2011. In order to accomplish this, I am attempting to utilize parallel computing on a 32 core ubuntu based-machine which is running Rstudio server.

This is the code that I am using to try to run the computation in parallel. Rstudio is using two cores to process the computation (determined via htop) suggesting I have achieved some level of parallel computation. However, I would like Rstudio to use more cores as it has up to 32 at its disposal.

f <- function(i) {
rc.shedding.otu <- raup_crick(df.shedding.otu, classic_metric = TRUE, plot_names_in_col1 = FALSE, reps = 999)
}

mclapply(1:100, f)

The application of mclapply() for parallel computing is relatively new to me. However, I was hoping that others more experienced in this field would be able to determine if this the result of an error in my code or a limitation based on the function that I am trying to perform. Any insight or advice is greatly appreciated!

Alex Romer
  • 27
  • 7
  • 2
    Try `mclapply(1:100, f, mc.cores = 16L)` or something similar. You might want to benchmark with a smaller sample at which point adding more cores does not improve (much) on your machine. – user12728748 Aug 07 '20 at 20:20
  • Thanks for the tip! I missed this argument when looking at the documentation for mclapply(). I'll definitely give that a go. – Alex Romer Aug 07 '20 at 21:47

1 Answers1

0

As user12728748 suggested, the fix for this issue was issuing a value for the argument mc.cores = #L

Alex Romer
  • 27
  • 7