Arithmetic without limitations?

Torbjorn Granlund tg at
Thu Feb 11 14:38:23 CET 2010

Paul Zimmermann <Paul.Zimmermann at> writes:

  > My idea for GMP has long been to make "hierarchical locality" take care
  > of it all.  A row in in the k-dimensional matrix would fit into L1
  > cache, a plane would fit into memory, further dimensions would live in
  > swap space (not exlicit files).
  I'm not sure this will work. Here is a concrete example, on a Core 2 with
  16Gb of RAM and 4Gb of swap. I'm trying to multiply two numbers of 6e9
  decimal digits, thus using about 2.5G of memory each.
  With GMP 5.0.1, top says:

The developments I was talking about are not in GMP 5.0.1.  The FFT
there has poor locality (which is mainly a property of its large
coefficient FFT).  Attemtping to compute large product with operands too
large for main memory will just result in early retirement of the swap
disk.  :-)

Besides, one will need lots of swap space for computing with large
numbers.  That's the natural way; You need to compute with a huge data
set?  Configure a huge swap area!  4 Gb (which I take as 4 gibibyte) is
not good for huge computations, and really strangely small for a machine
with 16 gibibyte RAM.

Special explicit swap files in a general purpose library is not imho a
good design.  In a special purpose program, perfectly fine.  (Perhaps
one could consider an optional interface in GMP where one makes
available explicit swap files, I haven't thought about that.)


More information about the gmp-devel mailing list