[net.arch] Long integers on the Cray?

mwm@eris.berkeley.edu (08/07/86)

Not sure where this ought to go, but these two groups look best.

Since Berkeley has just acquired a Cray, and I like playing with large
integers (100+ digits), having software to use the hardware that makes
the Cray go fast to deal with these becomes of interest. A quick
glance at the problem makes it look like you can do 1400+ bit adds in
1-2 nanoseconds/bit using the vector hardware.

Anyone got this (other than the NSA, who probably doesn't want to let
me have their code :-)? Anyone interested in it should I write it?

	Thanx,
	<mike

ken@argus.UUCP (Kenneth Ng) (08/09/86)

In article <1068@jade.BERKELEY.EDU>, mwm@eris.berkeley.edu writes:
> 
> Not sure where this ought to go, but these two groups look best.
> 
> Since Berkeley has just acquired a Cray, and I like playing with large
> integers (100+ digits), having software to use the hardware that makes
> the Cray go fast to deal with these becomes of interest. A quick
> glance at the problem makes it look like you can do 1400+ bit adds in
> 1-2 nanoseconds/bit using the vector hardware.
> 
> Anyone got this (other than the NSA, who probably doesn't want to let
> me have their code :-)? Anyone interested in it should I write it?
> 
> 	Thanx,
> 	<mike
Yeah, ask the guy that recently did the 30 million value of pi on
the Cray 2 over at NASA, I'll E-mail you a copy of the article.

-- 
Kenneth Ng:
Post office: NJIT - CCCC, Newark New Jersey  07102
uucp(for a while) ihnp4!allegra!bellcore!argus!ken
           !psuvax1!cmcl2!ciap!andromeda!argus!ken
     ***   WARNING:  NOT ken@bellcore.uucp ***
bitnet(prefered) ken@njitcccc.bitnet or ken@orion.bitnet

Spock: "Captain, you are an excellent Starship Captain, but as
a taxi driver, you leave much to be desired."

Kirk: "What do you mean, 'if both survive' ?"
T'Pow: "This combat is to the death"

wallach@convex.UUCP (08/11/86)

ne way to do this on a cray is the following.

partition the long integer into 63  (yes 63) bit partions. the higher
order bit is always set to 0. in th vector accumulator.

perform the add, etc.  compare the output with positive or negative.
(there is no compare vector on the cray) so use their test vm stuff.

then expand vm into a vector of integer 0 or 1.  this is the carry
out.  then add the carry vector and so on.

you want to check with some of the people as lawrence livermore.

their code is in the public domain.  call frank McMann in the compuer
science group.

steve wallach (convex computer .... convex!wallach)  

dik@mcvax.uucp (Dik T. Winter) (08/19/86)

(I tried to mail this for two times, but it failed.  So now it is on
the net.)

In article <1068@jade.BERKELEY.EDU> you write:
>
>Since Berkeley has just acquired a Cray, and I like playing with large
>integers (100+ digits), having software to use the hardware that makes
>the Cray go fast to deal with these becomes of interest. A quick
>glance at the problem makes it look like you can do 1400+ bit adds in
>1-2 nanoseconds/bit using the vector hardware.
>
>Anyone got this (other than the NSA, who probably doesn't want to let
>me have their code :-)? Anyone interested in it should I write it?
>
I have got something like that.  It is not flexible (i.e. integers are
fixed sized; and you have to account for double sized integers and
single size integers; further the size is built into the system;
changable by reassembling).  But it is reasonably fast.
Typically (if I remember the timings correct) the addition of two
100 digit numbers takes something like 50 micro seconds and the
multiplication of two such numbers takes 150 micro seconds.
This package was used by Arjen Lenstra for primality tests on large
numbers (see Mathematics of Computation, this or last year).

If you are interested, I may be able to send it to you.

Another possibility is to use the MP package (MP=Multiple Precision)
which is typically sued for floating-point numbers but is also
usable for integral numbers.  It is much more flexible, but slower.
It is by Richard Brent of the University of Australia in Canberra
(I think) and can be found in ACM Transactions on Mathematical
Software some years ago.

Hope this helps.  If you have still questions, just send me mail.
-- 
dik t. winter, cwi, amsterdam, nederland
UUCP: {seismo,decvax,philabs,okstate,garfield}!mcvax!dik
  or: dik@mcvax.uucp
ARPA: dik%mcvax.uucp@seismo.css.gov