Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upreplaced mvtnorm::rmvnorm with mvnfast::rmvn #28
Conversation
|
I just noticed that there is a copy and paste error in this pull request in line 166 of I probably should have figured this out by running the unit tests after rebuilding the documentation, but I was not sure how this work here. Does this work with |
|
@singmann Thanks for this. Ideally we'd have discussed this in an Issue first, but as I haven't exactly outlined how I'd like to receive contributions, that's on me :-) Could you outline what the perceived advantages of mvnfast are beyond just speed? I'm assuming that there is a memory consideration for big models/data sets spread over I don't want to make a habit of making changes to the package that will affect backwards compatibility. However, the package is currently early/young enough in the dev cycle that now is a good time to consider this and once we make a decision we can stick with it going forward. The tests are all standard testthat stuff. I don't use devtools myself much, but I assume that it will be able to run the tests in whatever way it interacts with testthat tests. I just run If you are running the tests, note that there are a couple of quite long-running tests that relate to a paper that we have submitted using gratia. You can turn this off by setting an environment variable |
|
Sorry for the delay, but I have done a bit more testing. First of all, my main interest is speed. To this end, I have now compared both functions,
Note, I have rerun each call at least once and got essentially the same results to the one shown here each time. Also, the difference in the effect of using only one core to multiple cores for I also checked that all three methods produce equivalent results:
I cannot really say much about memory efficiency, as I am haven't yet figured out to profile the memory easily. But from just looking at the graph of the OS, From my perspective this generally suggests superiority of Unfortunately, However, I am fine with not adding it to the package. It is of course your call. I know that backwards compatibility is important and the changes where really small and helped for my use case already. So not much work is lost if you reject it. In the end it was also easier to directly submit the pull request compared to opening an issue first. I had already done the changes. One more thing. about the package. Which command do you use to go from the |
|
@gavinsimpson Did you have time to consider this pull request? I still feel like it would be a nice addition that can increase speed with little downsides. I also removed the small bug and made sure it works with the current version. |
|
@singmann Yep; I've thought about this on an off whilst I've been busy with work and I agree with your evaluation and am happy to make this change. I'll take a look at merging this within in the next few days. Thanks for doing this. I'll do a review and see what needs doing to merge this. Could you add yourself as a contributor (ctb) in the |
|
Great. I have made a few more changes to this pull request to remove all remaining issues and make it easy to merge.
Let me know if there is anything else I can do to make this pull request easy for you. |
|
Thanks for this PR @singmann. This is now merged with a few tweaks. |
|
Thanks for accepting this. Should be quite helpful for larger models. |
This pull request replaces
mvtnorm::rmvnormwithmvnfast::rmvnand adds a new argument,ncores, to the corresponding functions which is passed through tomvnfast::rmvn. This allows generating random variables from the multivariate normal distribution with multiple cores (viaopenMP), which can speed up the simulation quite considerably for large models. I have also removed all import statements for the old package.Let me know if this is something you might consider. I am happy to discuss this should things be unclear.