On 4/9/13 12:15 AM, Aaron Meurer wrote:
> These are my timings:
> 
> gmpy ground types:


How do I install gmpy ground types?  Do I just install GMPY from source
and reinstall python to use those ?


> 
> In [19]: from sympy.polys.benchmarks import bench_solvers
> 
> In [20]: %time _ = bench_solvers.time_eqs_165x165()
> CPU times: user 590 ms, sys: 86.9 ms, total: 677 ms
> Wall time: 625 ms
> 
> In [21]: %time _ = bench_solvers.time_to_expr_eqs_165x165()
> CPU times: user 4.01 s, sys: 149 ms, total: 4.16 s
> Wall time: 4.08 s
> 
> In [22]: %time _ = bench_solvers.time_verify_sol_165x165()
> CPU times: user 4.66 s, sys: 106 ms, total: 4.76 s
> Wall time: 4.69 s
> 
> In [23]: %time _ = bench_solvers.time_solve_lin_sys_165x165()
> CPU times: user 2.95 s, sys: 192 ms, total: 3.15 s
> Wall time: 3.02 s
> 
> Python ground types
> 
> In [1]: from sympy.polys.benchmarks import bench_solvers
> 
> In [2]: %time _ = bench_solvers.time_eqs_165x165()
> CPU times: user 975 ms, sys: 154 ms, total: 1.13 s
> Wall time: 1.03 s
> 
> In [3]: %time _ = bench_solvers.time_to_expr_eqs_165x165()
> CPU times: user 4.98 s, sys: 113 ms, total: 5.09 s
> Wall time: 5.03 s
> 
> In [4]: %time _ = bench_solvers.time_verify_sol_165x165()
> CPU times: user 6.73 s, sys: 64.7 ms, total: 6.79 s
> Wall time: 6.75 s
> 
> In [5]: %time _ = bench_solvers.time_solve_lin_sys_165x165()
> CPU times: user 26.2 s, sys: 112 ms, total: 26.4 s
> Wall time: 26.3 s
> 
> So the ground types do make a difference, especially in the solve
> times. Note that if gmpy is not installed, it just uses Python ints
> and Fraction for integers and rational numbers (it's likely Fraction
> that is so slow, since it has basic operations like addition and gcd
> implemented in Python loops).
> 
> Aaron Meurer
> 
> On Tue, Apr 9, 2013 at 12:05 AM, ThanhVu Nguyen
> <[email protected]> wrote:
>>  If you want to try it out you have to use
>>>
>>> sparse-polys branch from #1840 pull request. Here is a sample code:
>>>
>>> In [1]: from sympy.polys.benchmarks.bench_solvers import *
>>>
>>> In [2]: %time eqs = eqs_165x165()
>>> CPU times: user 2.12 s, sys: 0.01 s, total: 2.13 s
>>> Wall time: 2.12 s
>>>
>>> In [3]: %time sol = solve_lin_sys(eqs, R_165)
>>> CPU times: user 1.60 s, sys: 0.01 s, total: 1.60 s
>>> Wall time: 1.59 s
>>>
>>>>
>>>>
>>
>>
>>
>> Hi, I just tried the  benchmark  file from the latest git pull but was not
>> able to achieve  such good performance .    I don't have GMP installed so
>> using whatever that sympy uses by default.  My test below shows solving
>> these equations takes 32 secs, which  is 27 times longer than generating
>> them 1.2 s.   This contrasts with your stats above which indicates solving
>> these equations takes 1.6 s, which is even faster than generating them in
>> 2.12s  (is it  even possible ??).
>>
>> Your solve_lin_sy() function is indeed much faster  than the default
>> solve(), taking over 600 s.  However when I've tried size 248x248 and Sage's
>> solve() still solves under two min but your solve_lin_sys() takes over 20
>> mins,  at which point I just gave up and kill the process.  (If you need
>> these data let me know)
>>
>>
>> All the tests below were done on my MacBook in 2011, 2.3 Ghz i3 with 8 GB
>> Ram . Perhaps I should install GMP and try again ?
>>
>> In [1]: import bench_solvers
>>
>> In [2]: %time _ = bench_solvers.time_eqs_165x165()
>> CPU times: user 1.18 s, sys: 0.09 s, total: 1.27 s
>> Wall time: 1.21 s
>>
>> In [3]: %time _ = bench_solvers.time_to_expr_eqs_165x165()
>> CPU times: user 6.10 s, sys: 0.12 s, total: 6.22 s
>> Wall time: 6.16 s
>>
>> In [4]: %time _ = bench_solvers.time_verify_sol_165x165()
>> CPU times: user 8.07 s, sys: 0.05 s, total: 8.12 s
>> Wall time: 8.10 s
>>
>> In [5]: %time _ = bench_solvers.time_solve_lin_sys_165x165()
>> CPU times: user 32.52 s, sys: 0.11 s, total: 32.63 s
>> Wall time: 32.62 s
>>
>>
>> In [7]: eqs = bench_solvers.eqs_165x165()
>>
>> In [8]: eqs_ = [eqt.as_expr() for eqt in eqs]
>>
>> In [11]: from sympy import solve
>>
>> In [9]: %time _ = solve(eqs_,as_dict=True)   #default solve()
>> CPU times: user 610.49 s, sys: 2.05 s, total: 612.54 s
>> Wall time: 614.68 s
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to