[pythran] Re: gmp

  • From: serge Guelton <serge.guelton@xxxxxxxxxxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx
  • Date: Sat, 27 Oct 2012 22:44:02 +0200

On Sat, Oct 27, 2012 at 03:54:45PM +0200, Brunet Pierrick wrote:
>    Hi,
>
>    About last commit, I did some modification as I never tested to use
>    a long
>    as pythran input specification. In the code, we need to use
>    mpz_class as a
>    constructed type to have a correct behaviour.
>    Also, I fix another issue un the conversion from pylong to
>    mpz_class.
>
>    I tested the code below and get an error:
>
>    #export pythran test(long)
>    def test(a)
>    ??? for i in xrange(a):
>    ...
>
>    Because xrange doesn't support long as input parameter. It looks
>    like
>    python doesn't support either.

Ok. If Cpython fails, we can fail too :-)

>
>    About profiling, I did some test using the binamial law with : 10
>    by 60.
>    Result look good and we have almost the same ratio with others
>    numbers. I
>    just need to find some others bench
>
>    In [4]: %timeit test1.test(10,60)
>    100000 loops, best of 3: 5.26 us per loop
>
>    In [5]: %timeit test2.test(10,60)
>    100000 loops, best of 3: 5.32 us per loop
>
>    In [6]: %timeit test3.test(10,60)
>    100000 loops, best of 3: 11.5 us per loop

mmmh, where is the reference ? CPython timings ? g++ flags used by
pythran ?

>
>    Finally, we have another error now:
>
>    if we define a long num : a = 1111111111111L
>    and add a float: b = a +2.5
>    the result is b = 1111111111113L
>    Pythran doesn't care about the value after the point.
>    Issue comme from Assignable specification but we can't do this in
>    another
>    way as gmp have some limitation about Templates :
>    
> [1]http://gmplib.org/manual/C_002b_002b-Interface-Limitations.html#C_002b_002b-Interface-Limitations

Does it mean we have to make all arguments assignable ?

>
>    The solution can be to concidere long as mpf_class instead of
>    mpz_class.
>    But if we keep the same precision, we will lose some performance.
Disgusting.
>
>    Have a good week end.
u2 !
>
> References
>


Other related posts: