Info for using 32-bit source

The latest version is 1.2.2.

Source code is in v122/ecdl2-97.c or v122/ecdl2-97.c.gz.

The only significant change from 1.2.1 is that the inverse() function is made faster by adopting a trick from the 64-bit version.

The overall speed-up is only a few percent so there is no need to upgrade if you're already happily running 1.2.0 or 1.2.1.

Good luck,

> ecdl2-97.c
Purpose: Fast arithmetic for computing discrete logs on elliptic curves.
Copyright: Robert J. Harley, 1997-1999.
Legalese: This source code is subject to the GNU Public License (v2).

This is ECDL32, version 1.2.2.

Consult the following URL for more information:


Do this:

cc -O3 ecdl2-97.c -o ecdl
mkdir `uname -n`
cd `uname -n`
nice ../ecdl mail `whoami` MyTeam `uname -n` `uname -m` `uname -s` > log &

Detailed instructions

1. Compiling

Compile with something like:

gcc ecdl2-97.c -o ecdl -O3 -fomit-frame-pointer -freg-struct-return

You can test the binary like this:

./ecdl test me Testers bla bla bla

The test output should match the sample below except for the number of iterations per second.

If the program complains that it cannot find sendmail, you can add -DSENDMAIL='"/usr/sbin/sendmail"' or something similar.

Test output follows:

ECDL32, version: 122.
Mode ...... test
User ...... me
Team ...... Testers
Machine ... bla
Hardware .. bla
OS ........ bla
Comment ... none
Generating 16 new starting points.
Computing iterations...
Iterations during this run = 1.00699e+06 at 123255 per second.
Iterations during this run = 2.73e+06 at 123251 per second.
Iterations during this run = 3.22742e+06 at 123231 per second.
Iterations during this run = 3.71989e+06 at 123216 per second.
Iterations during this run = 3.75563e+06 at 123176 per second.
Iterations during this run = 4.7175e+06 at 123237 per second.
Iterations during this run = 4.84701e+06 at 123239 per second.
[...and so on...]

2. Optimising

Good speeds are roughly 120 k iterations per second for a 500 MHz x86, 145 k for a 450 MHz PowerPC G3 and 60 k for a 275 MHz StrongARM. You can compile with various optimisation flags to maximise speed before starting on the real calculations.

You can try defining -DPROD=2 or -DPROD=3 to use different implementations of two speed critical functions. They might or might not be faster depending on your chip and compiler.

You can also try tweaking the value of PARAL. Just add -DPARAL=12, for instance. The default is 16 and useful values are roughly in the range 8 to 20. Note that the test output will no longer exactly match the sample given above.

3. Starting up

When you're ready to start up: on each machine you want to run on make a directory for that machine, cd into it and go.

mkdir `uname -n`
cd `uname -n`
unlimit cputime || (echo Using ulimit instead; ulimit -t unlimited)
nohup nice +15 ../ecdl [...arguments, see below...] > log &

NB: Some shells need nice -15 instead. If you have a machine with several CPUs, make a directory for each CPU and start up an ecdl process in each one.

The arguments have the following syntax:

ecdl <mode> <user> <team> <machine> <hardware> <OS> { <comment> }

<mode>: Either test, mail, alt or batch.
<user>: Something to identify you by e.g., your email address.
<team>: Name of the team you are on e.g., one you just made up!
<machine>: The machine name e.g., as given by uname -n.
<hardware>: The machine hardware type e.g., as given by uname -m.
<OS>: The OS name e.g., as given by uname -s.
<comment>: Optional extra text.

None of these fields should contain the | character but they can contain spaces and stuff as long as you use 'single quotes' around the fields concerned on the command line.


ecdl mail 'Robert Harley' INRIA corton '500 MHz 21164a' Linux
ecdl mail biff@skool 'Hackerz from Hell' `uname -n` `uname -m` `uname -s`
ecdl batch anon 'Anonymous People' bla bla bla 'Yo dude, check this out!'

Test mode quickly produces some (useless) output to stdout along with info on iterations per second. This allows you to check that your binary is OK, to compare compiler optimisation flags etc.

Mail mode emails a result back to every few hours or so (as well as writing it to stdout). INRIA's excessively aggressive spam filters might refuse the email; in that case switch to alt mode which sends to instead.

For machines not permanently connected to the Net, batch mode only writes the results to stdout, so you should redirect that to a log file and email the file (or just the new lines at the end of it) by hand once in a while. Beware of mailers that wrap long lines, though!

4. Shutting down (and saved states)

When the program is running it saves its internal state in a file (called from time to time. The reason each machine should have its own directory is to avoid the saved states getting mixed up! If you want to stop the program, the best way is to find it's PID (first column of the ps output) and send the TERM signal which causes it to save its state and exit:

ps x | grep ecdl
kill -TERM <the PID>

When you restart in the same directory:

nohup nice +15 ../ecdl [...arguments...] >> log &

the program will look for the saved state file. If no saved state is found it will generate a new state and work from there. If one is found, the program reads it, and continues where it left off. Note that it would be wasteful to use a given saved state on more than one CPU because work would just be duplicated. Note also that test mode does not mess with the saved state.