Pari lib with Math-BigInt (win32)

  • Thread starter gnu valued customer
  • Start date
G

gnu valued customer

hello,

Win2k sp3
Perl 5.8.1 (ActiveState extensions)

using Math-Pari 2.010500

and the latest Math-BigInt i've
tried to install and use
Math-BigInt-Pari.

Everything installs fine, but I get
this warning when I call like so

use Math::BigInt lib => 'Pari';

warning:
Cannot load outdated Math::BigInt::pari v1.10, please
upgrade at ... (points to about 'use')

The script is reverting to the Pure-Perl version of
Math-BigInt (slow).

tia for your help,
Mark Pryor
 
S

Sisyphus

gnu said:
warning:
Cannot load outdated Math::BigInt::pari v1.10, please
upgrade at ... (points to about 'use')

Version 1.10 was put on CPAN earlier this year, and is the latest
available ... calling it "outdated" seems a little severe to me :)

I get the same. The error is produced by Math::BigInt-1.70 - search
'BigInt.pm' for "outdated". I tried Math::BigInt-1.64 and the error did
not arise, though 'nmake test' threw up some other errors. Perhaps using
version 1.69 or 1.68 instead of 1.70 would provide a temporary workaround.

The M::BI::p author (Tels), who is also currently maintaining M::BI,
might be able to provide some insight if you don't get a satisfactory
answer here. (He should at least be informed of the problem.)

Cheers,
Rob
 
G

gnu valued customer

Hello Rob,
Sisyphus said:
Version 1.10 was put on CPAN earlier this year, and is the latest
available ... calling it "outdated" seems a little severe to me :)

I get the same. The error is produced by Math::BigInt-1.70 - search
'BigInt.pm' for "outdated". I tried Math::BigInt-1.64 and the error did
not arise, though 'nmake test' threw up some other errors. Perhaps using
version 1.69 or 1.68 instead of 1.70 would provide a temporary workaround.

After having this suggestion seconded by Tels, I found v. 1.68 here
http://backpan.cpan.org/authors/id/T/TE/TELS/math/

Thanks Rob for pointing out such an easy workaround. Someone was saying
that I'd have to edit Math-BigInt-Pari myself, or wait 2 weeks!

By the way, using Pari underneath Math-BigInt is giving me a
several-order-of-magnitude speed increase. In the Pure-Perl case, computing
a 2048 bit Diffie-Hellman secret took over 1 minute; with (lib => 'Pari'), it
takes less than 1 second.

I'm prototyping the use of Perl(cgi) as a DH key server to the
Win32 CryptoAPI. With this speed increase I'm now planning on
finishing the prototyping, instead of giving up (in vain).

regards,
Mark
The M::BI::p author (Tels), who is also currently maintaining M::BI,
might be able to provide some insight if you don't get a satisfactory
answer here. (He should at least be informed of the problem.)

I saw Tels post today in the ASPN Mailing list. Thanks to Tels for
confirmation the workaround of using an earlier version (<1.70)
 
S

Sisyphus

gnu said:
By the way, using Pari underneath Math-BigInt is giving me a
several-order-of-magnitude speed increase. In the Pure-Perl case, computing
a 2048 bit Diffie-Hellman secret took over 1 minute; with (lib => 'Pari'), it
takes less than 1 second.

Yes, pure-perl doesn't deal so well with modular exponentiation - which
I would think is what eats up the time in your Diffie-Hellman computations.

I generally find that using GMP instead of Pari provides a further
(significant) speed increase. In the script below, I find GMP to be 20
times faster than Pari, but results vary depending upon the actual size
of the operands and the types of computations being conducted.

----------------------------------
use Math::BigInt;
#use Math::BigInt lib => 'GMP'; # Plug M::BI into M::GMP
#use Math::BigInt lib => 'Pari'; # Plug M::BI into M::pari

use warnings;
use Benchmark;

$n = Math::BigInt->new('3' x 400);
$e = Math::BigInt->new('7' x 400);
$m = $e - 10;

timethese(1, {
'bench' => '$n->bmodpow($e, $m);',
});

print $n, "\n";
----------------------------------

If you want to try GMP on Win32, you can get the necesssary GMP dll from:
http://www.kalinabears.com.au/w32perl/GMP-4.1.3-msvc.tar.gz

Just extract 'libgmp-3.dll' from the tarball and place it somewhere in
your path. You won't need any of the other files contained in the tarball.

There's also Win32 binaries of Math::BigInt::GMP available.

Download for perl 5.6:
http://www.kalinabears.com.au/w32perl/Math-BigInt-GMP-56.tar.gz

Download for perl 5.8:
http://www.kalinabears.com.au/w32perl/Math-BigInt-GMP-58.tar.gz

Just install as per instructions in the Readme.

I've only just recently updated those files, and haven't yet checked to
see if anything has been broken in the process :)
If anyone does find there's something that's broke, please let me know.

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top