On Aug 24, 5:02 pm, Jason Moxham <ja...@njkfrudils.plus.com> wrote:
> nlimbs(a+b)<=max(nlimbs(a),nlimbs(b))+1 > nlimbs(a*b)<=nlimbs(a)+nlimbs(b) > > but this is for the answer only , it doesn't include any temp space needed to > perform the calculation eg we multiply by FFT and need approx 6x the space > above. The temp space is not just limbs but can include structures (eg > matrix'es for GCD calcs , prime tables for factorials,etc) > Perhaps if the sage process sets the ulimit stack high enough , then gmp can > use that (like it used to , back in the bad old days) Oops, thanks for correcting me I already thought something was odd about the bounds. My question was really: If I reserve limbs on the target mpz_t as above, will GMP perform a reallocate on the limb pointer of the target? GMP would still have access to a memory manager, and I assume GMP deallocates temps it allocates. The reason why we cannot change the GMP memory manager when ECL is around, is that ECL does not explicitly deallocate its bignums. It relies on Boehm-Weiser to reclaim the memory. So if we set GMP to use the Python memory manager, the memory would never be reclaimed. Therefore, one solution would be to make it so that any mpz_t that ECL allocates and might not explicitly deallocate, gets explicitly preallocated with enough space so that GMP will not realloc its limbs (this is why I need the bounds). Then we can safely set GMP to use the Python memory manager again. I'm not looking forward to that solution, because it would require a considerable amount of changes to ECL. These changes might not be taken up by upstream either (what's their benefit?), so that could cause quite a maintenance nightmare. Hence, building ecl with a private GMP lib would have my strong preference. I haven't been able to find any documentation on how to do that, though. Do we need a libgmp.a instead of a libgmp.so for that? Do we need libgmp.a built with -fPIC (I've tried with other "libgmp.a"s lying around and that's what gcc suggested)? How do we prevent the symbols in libgmp.a from ending up being exported from libecl.so? Sage currently does not have a libgmp.a in local/lib. Does that have a reason? --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---