Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

threads not being respected and defaulting to 1 #249

Open
4 of 5 tasks
pdimens opened this issue Oct 24, 2021 · 1 comment
Open
4 of 5 tasks

threads not being respected and defaulting to 1 #249

pdimens opened this issue Oct 24, 2021 · 1 comment

Comments

@pdimens
Copy link

pdimens commented Oct 24, 2021

  • I have the most recent version of poppr and R
  • I have found a bug
  • I want to request a new feature

Please include a brief description of the problem with a code example:

I have a dataset with which parallelized AMOVA would dramatically speed up runtime. Using threads = 20L for 20 threads (or any value, for that matter) results in only a single thread being used each time when running a script via Rscript.

System

Arch Linux
R 4.4.1
poppr 2.9.3:

This is poppr version 2.9.3. To get started, type package?poppr
OMP parallel support: available
# part of the Rscript
amova_results_neut <- poppr.amova(
  bft_neut,
  hier = ~year/population,
  clonecorrect = FALSE,
  within = TRUE,
  squared = TRUE,
  correction = "quasieuclid",
  algorithm = "farthest_neighbor",
  threads = 20L,
  missing = "loci",
  cutoff = 0.1,
  quiet = FALSE,
  method = "pegas",
  nperm = 50000
)

and the bash top command

   PID     USER  NI    RES    SHR S  %CPU  %MEM     TIME+                        COMMAND
156535  pdimens   0 723056  19884 R 100.0   0.3   8:13.11                              R

@zkamvar
Copy link
Member

zkamvar commented Oct 31, 2021

The threads argument refers to the number of cores used to filter the data and/or calculate the distance before it is passed to the AMOVA function in the imported package (in this case, {pegas}). After that, {pegas}' implementation will run serially because they have not yet implemented parallelization (which for several reasons is not so simple to do in a cross-platform way in R).

Since the permutation procedure is buried inside the {pegas} implementation of AMOVA, there's not much I can do to improve that timing. My suggestion would be to request that the author of {pegas} add the possibility for parallelization in the AMOVA function (which should be possible with the {future} package).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants