-
Notifications
You must be signed in to change notification settings - Fork 139
Add betainc C implementation #673
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
Conversation
Hi everyone, just wanted to mention that based on the work by @aloctavodia and the existing gamma.c file, I did some polishing to the cephes incbeta.c and got it to compile on the CPU. Will test GPU later. I'm not sure what the github best practice is when hijacking someone else's pull request. Maybe you can have a look and let me know if this is of value and how to proceed. Stuff is over at my fork, I had to branch off an earlier version of pytensor to keep compatible with my PyMC installation, but I guess this is an easy fix. Cheers and all the best, Edit / PS: I wanted to mention that I found the debug mode and used it for testing the implementation. What an amazing feature! |
This is great @arthus701. Thanks. |
Just tested it on a GPU and compiling works. I don't see a speedup though. |
What do you mean you tested on the GPU? We don't have native GPU support in this backend (C-backend). I also don't expect speedups in many cases. The warning is a bit too crude, we should probably disable it |
You can push your changes directly to this PR or open a new PR whatever suits you better |
It seems I misunderstood what is going on. When using Thanks and have a nice weekend, |
If the warning disappeared it probably meant the GPU machine was not finding the C-linker, and was running in python mode. Which should be slower anyway. Also what sampler where you using? If using a jax or numba-based sampler, the C backend does not matter. The warning is still emitted though (see #140). |
Ah, okay. I'm using jax and was seeing a big increase in compute time when including the beta-cdf, but likely that's related to the more complicated model then and not to the C code as I was figuring from the warning. Thanks a lot for your explanation. Does the warning disappearing still indicate a problem? Anyway, if you think my work is of use I can update my branch to the most recent commits and open a separate PR on monday, just let me know. Cheers. |
Likely not, although sample_prior_predictive / sample_posterior_predictive may be a bit slower. I'm curious in what part of the workflow where you seeing the warning. Could you set
Since the works is already done, no reason not to get it merged. Would be much appreciated! I opened #794 to avoid wasting people's time in the future. This warning is not useful in the current state of things. |
Sure thing, will address both points on Monday. |
Is this the output you're after?
|
That traceback is truncated, can you post the whole thing? |
I'm sorry, but that's all I get from using Edit: I realized that setting the simplefilter did extend the message, but the warning is not being caught, i.e. the program continues to run. Is that a known issue with pyMC/pytensor? |
Strange, the traceback should show something being called from PyMC at least. No worries if it's not then |
Not sure if this is all that needs to be done.
The warning message disappeared and sampling provides the same result as without this change. But speed is still the same.The code for the c implementation is from here https://github.com/codeplea/incbeta, there is a blog post associated https://codeplea.com/incomplete-beta-function-cI take the files from https://www.netlib.org/cephes/ the code does not compile. Maybe I am missingsome extra files...