I made both issues into trac tickets. See #269 and #270. One is a
blocker for MPIR 1.3 as it regards a serious bug by the looks of it.

Bill.

2010/1/3 Cactus <rieman...@googlemail.com>:
>
>
> On Jan 3, 8:15 pm, Case Vanhorsen <cas...@gmail.com> wrote:
>> Hello,
>>
>> I discovered an interesting memory allocation behavior on Windows vs.
>> Linux. I was testing GMPY on 64-bit Windows when I stumbled into this.
>> GMPY replaces the native MPIR memory allocation routines with Python's
>> memory allocator. If I enable debugging in GMPY, I get a trace of all
>> the memory allocation calls. When I ran the following:
>>
>> python -mtimeit -n 1 -r 1 -s "import
>> gmpy;gmpy.mpz(3)**(2**27);gmpy.set_debug(1)" "a=a*a" 2>temp.txt
>>
>> and look at the output saved in temp.txt, I see that Linux generated
>> approximately 34 memory manager calls but Windows generates over
>> 100,000 calls. Most of the Windows allocations are for small (<8K)
>> chunks of memory while all the Linux requests are for more than 64K.
>> The performance between Linux and Windows is similar. Could it be that
>> Windows is not using alloca?
>>
>> I also think I found another memory allocation bug. If I run the above
>> multiplication repeatedly:
>>
>> python -mtimeit -s "import
>> gmpy;gmpy.mpz(3)**(2**27);gmpy.set_debug(1)" "a=a*a" 2>temp.txt
>>
>> it will eventually crash. In looking at the debug output, I see a
>> request to allocate 18446744073709498400 bytes of memory.
>>
>> I tested with both MPIR 1.2.2 and 1.3.0 and get similar behavior. I'm
>> using a custom version of GMPY with some fixes for size_t vs. long
>> issues that hasn't been committed but I will try to commit those
>> changes later today.
>
> Hi Case
>
> That is _very_ useful information and may explain why Windows
> performance lgas that on Linux.
>
> A long time ago - in GMP days - I had to turn of the use of alloca as
> I kept getting crashes if I used it.
>
> I have not tried switching it on in MPIR but I will certainly look at
> this again.
>
> But _alloca is now deprecated on Windows and its replacement requires
> a 'free' procedure that alloca doesn't need. It may hence be quite
> difficult to take advantage of this in future.  It all depends on how
> GMP/MPIR use alloca.
>
> Thanks for the debugging!
>
>   Brian
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "mpir-devel" group.
> To post to this group, send email to mpir-de...@googlegroups.com.
> To unsubscribe from this group, send email to 
> mpir-devel+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/mpir-devel?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to mpir-de...@googlegroups.com.
To unsubscribe from this group, send email to 
mpir-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.


Reply via email to