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

request to add parallel run in structureRun #58

Open
fernandabiologia opened this issue Sep 2, 2022 · 1 comment
Open

request to add parallel run in structureRun #58

fernandabiologia opened this issue Sep 2, 2022 · 1 comment

Comments

@fernandabiologia
Copy link

Hi Eric,

Thanks for the great package. I've been using strataG for some time now, and I recently had to run a STRUCTURE analysis with a large sample size which was very slow.

I was wondering if would be possible to add parallel processing in the function structureRun to speed up? In that way the user could provide to an argument how many cores to use.

Thank you.

@EricArcher
Copy link
Owner

STRUCTURE doesn't make use of multiple cores internally, so I can't take advantage of that capability in the structureRun() wrapper. The most I could do is convert it to optionally run each value of K on a separate core. Since files are currently being written to the working directory, I need to make sure there won't be conflicts with filenames among the cores (I think the seed file doesn't currently get a special name with the user-specified label at the moment). It'll give me the opportunity to also add the option of writing to (and reading from) a temporary folder as a default which I've wanted to put in place for a while.
Unfortunately, I'm pretty busy with other work at the moment, so I'll have to put this on my future To-Do list.

However, you should be able to create this functionality yourself with something like (untested) :

sr.list <- parallel::mclapply(
  2:5, 
  function(k) structureRun(g, k = k, ...),
  mc.cores = 5
})

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

No branches or pull requests

2 participants