-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Enable Boost.Multiprecision with MSVC and recent boost #5153
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
What do you have in mind with polishing when you write |
Probably what is discussed in #3614 (mentioned on the previous line), in particular to_double, possibly to_interval. |
As this PR is merged the polishing is done? |
I don't think so. |
The polishing you are both talking about, is it the content of specializations of |
If it is mostly to_double / to_interval for Quotient, they do appear to be part of Real_embeddable_traits. |
|
Note that you need Boost>=1.70 to see the benefits. |
Is |
You know that we have users who can run CGAL code without GMP at all (and with or without LEDA). We did the work, using |
Please don't, those are separate issues. @afabri Epick and Epeck use Exact_field_selector. |
So this means BEFORE this PR for non-windows users we have non-reference counted GMP and for Windows users reference counted ? |
I don't believe there was any announcement in CHANGES.md when we switched to gmpxx/boost_mp on linux and mac. Do you expect one for windows? |
Yes, because that was an error not to document that change for linux and mac. |
If you want to document that somewhere, feel free to add something to the doc of Epeck or Exact_rational in a separate PR. |
Can it really be |
|
In Simon's arrangement benchmark it is slightly slower. |
We should redo the benchs on Linux too, then. |
Which one is that? Is it in benchmark/Arrangement_on_surface_2? |
Indeed. IIRC, the kind of test that was run last time was more like Orientation_3 with Simple_cartesian Note that I would still be interested in a run of the testsuite to check that it works on windows. Then we could at least enable boost_mp on windows, even if we don't make it the default. |
I don't understand this sentence. Can you please elaborate. What has to be done (in order to achieve what)? |
It is so, but irrelevant if the function is inlined, and if the function is not inlined the function is likely expensive and the cost of the reference negligible.
We have one for mpq_class and mpq_rational, and could easily add one for Gmpq. But also, a-b==0 looks like a complicated way to say a==b...
I believe we should focus on Epeck. But it isn't clear if the default rational type in Epeck should be the same as the default rational type for other uses.
👍 that's why I was testing it 😉 |
You probably know this already, but for Boost.Multiprecision all the number types are required to interoperate with all other number types (obviously including integer literals) as long as the implied implicit conversion is not "lossy". Generally speaking, these mixed operations are significantly faster than constructing a temporary. There is one - perhaps somewhat theoretical - exception: if one argument to an operation is an rvalue, then we can reuse that variable as working storage during the operation. It's often tricky to program without introducing subtle bugs though, so it's not actually used that much currently. |
Well, you misrepresent a little bit, because the |
Don't we have static variables |
The compiler cannot CSE (common sub-expression) code using rationals. If the same computed value is reused, it should be stored in a variable, not computed twice. |
We have a variable here |
So what is used for functors which are division free, if GMP is not installed? |
MP_Float template <>
struct Exact_ring_selector<double>
#ifdef CGAL_HAS_MPZF
{ typedef Mpzf Type; };
#elif defined(CGAL_HAS_THREADS) || !defined(CGAL_USE_GMP)
{ typedef MP_Float Type; };
#else
{ typedef Gmpzf Type; };
#endif |
So is the intuition that |
MP_Float is the last (slowest) choice here for when we cannot use Mpzf or Gmpzf. It is still faster than using a rational, since +-* operations on MP_Float are just that and don't involve a reduction to the same denominator like a rational, but if the other two are available, they are likely better than MP_Float for all purposes. The fact that a MP_Float (like Mpzf and Gmpzf) can represent a double does give |
Revert b59f696 I have no idea why that commit was done, in an unrelated PR.
@jzmaddock can you in the code point out where the temporaries are you mention, as well the error checking code? |
Successfully tested in https://cgal.geometryfactory.com/CGAL/testsuite/results-5.3-Ic-34.shtml |
@mglisse @afabri, Maxime just marked this PR as successfully "Tested" in the testsuite, but it seems there is still an ongoing discussion. Should I merge the PR as it is, or wait? |
The discussions about cpp_rational are unrelated to this PR. |
Summary of Changes
In #3406, the plan was
But apart from a reminder in #4495 it was forgotten.
This branch is completely untested, the whole point is for the testsuite to run on it (I checked and there is at least one platform with msvc and a recent enough boost).
Release Management