-
Notifications
You must be signed in to change notification settings - Fork 180
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
MR::Math::betaincreg(): Use lgamma_r() #2866
Conversation
Re-entrant version of function that yields logarithm of (absolute value of) gamma function must be used to ensure thread safety, given that this function may be executed by different threads during non-parametric permutation testing.
As mentioned in the meeting today, Anyhow, we should at least use
|
@daljit46: I want to do something like 186356f, where we both check for the presence of that function (making use of the Also, I'm revoking the "Closes #2857" in the OP. While this PR will hopefully resolve the issues around specifically |
Also, in |
If deemed available during cmake configuration, make use of external function lgamma_r(); if not available, lock mutex across threads to ensure safe use of std::lgamma().
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
Can confirm same issue on my local Windows machine as what's happening on CI: the |
clang-tidy review says "All clean, LGTM! 👍" |
Yes, I think that's right. We can re-introduce this again I suppose (e.g. using |
Using CheckSourceCompiles doesn't actually test linking. CheckSymbolExists does. On MacOS, it seems that lgamma_r needs _REENTRANT macro to defined to the thread-safe version of lgamma to be visible, so we make the check by making use of CMAKE_REQUIRED_DEFINITIONS.
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
Partially addresses #2857.
Hopefully the concern about
lgamma_r()
only being available on "some" systems should not be of concern for us given the target systems...