Hello, this post contains the fourth report of my GSoC progress. We hit Piranha
's speed,
the highlight of this week.
Progress
We were able to reach Piranha
's speed. At an average 14-ish ms
to the benchmark, we are happy enough (still can be improved) to start wrapping this low-level implementation to a Polynomial
class. Last week I had reported speed 23ms
and this week we are better.
We had missed out a compiler flag, DNDEBUG
to indicate Release
mode of Piranha
leading to slow-down, #482.
Adding this compiler flag means we should not be using assert
statement, which SymEngine
does in SYMENGINE_ASSERT
and test files too. These had to be sorted out if Piranha
were to be a hard dependency of SymEngine
's polynomial module.
Hence, the issue of moving the tests suite from assert
s to a well-developed test framework came up again, #282. We explored a couple, but Catch
still seemed to be the best option. Catch
was implemented, which is a benefit to SymEngine
in the long run too.
As for the SYMENGINE_ASSERT
, we decided to change our macro to raise an exception or just abort the program.
Catch is a very good tool. We thank Phil Nash and all the contributors for making it.
Next up, wrapping into Polynomial
.
We need some functionality to convert a
SymEngine
expression(Basic
) into one ofhashset
representations directly. Now I convertbasic
topoly
and then tohashset
as just getting the speed right was the issue.Domains of coefficients need to be thought of.
SymPy
andSage
will be need to looked into and their APIs need to be studied. We needZZ
,QQ
andEX
, the work forEX
has been done by Francesco Biscani, this will be patched for the latest master and commited in his name. There could also be an automatic mode, which figures out the fastest representation for the given expression, at the price of a little slower conversion, as it needs to traverse the expression to figure out what representation fits.tuple
topacked
conversion when exponents don't fit. Alsoencode
supports signed ints which is a boon to us, as we don't have to worry about negative exponents. Forrational
exponents we use tuple.
I still haven't figured out the reason for slow down of expand2
and expand2b
in my packint
branch. I have been suggested to use git bisect
. Will do next week.
Report
expand2d
results:
Result of 10 execution: 14ms
14ms
14ms
15ms
14ms
15ms
14ms
14ms
15ms
14ms
Maximum: 15ms
Minimum: 14ms
Average: 14.3ms
Here, the evaluate_sparsity()
gave the following result for the hash_set
0,11488
1,3605
2,1206
3,85
Piranha
has the following results
Average: 13.421ms
Maximum: 13.875ms
Minimum: 12.964ms
A more detailed report of benchmarks and comparisons can be found here
A minor PR where MPFR was added as a Piranha dependency, 472 was merged.
Another PR in which the tests where moved to Catch
is good to play with and merge, minor build nits remaining, 484.
Targets for Week 5
- Figure out the reason for slow down in benchmarks, fix that.
- Change the
SYMENGINE_ASSERT
macro to raise an exception. - Add the
DNDEBUG
flag for withPiranha
builds, as nowSymEngine
doesn't useassert
, close issue #482. - Port
@bluescarni
's work ofEX
to SymEngine. - Wrap the lower-level into
Polynomial
for signed integer exponents inZZ
domain with functionality atleast that ofUnivariatePolynomial
.
That's all this week.
Sbohem