Bill Allombert on Tue, 21 Jan 2014 15:39:54 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Parallel GP for windows


Dear PARI testers,

I have made an attempt at a standalone Windows GP binary that support parallel GP:

<http://pari.math.u-bordeaux.fr/pub/pari/windows/snapshot/gp-git6d71cdc-pthread.exe>

You have to set nbthreads manually, e.g.
default(nbthreads,4) if you want to use 4 threads.
You can use the attached file parallel to test.

I did not tested it on real windows system.
I like to know whether the binary is as fast as the normal standalone binary
and whether parallelism works reliably.

Cheers,
Bill.
V=[2^256 + 1, 2^193 - 1];
parapply(factor,V)
my(V=[2^256 + 1, 2^193 - 1]); parvector(#V,i,factor(V[i]))
fun(V)=pareval(vector(#V,i,()->factor(V[i])));
fun(V)
parfirst(fun,V)=parfor(i=1,#V,fun(V[i]),j,if(j,return([i,j])));
parfirst(isprime, [2^600..2^600+1000])[1]
parselect(isprime, [2^600..2^600+1000],1)
parselect(isprime, [2^600..2^600+1000])

/* Disable tests that depends on ellsea
findp(E,n)=
{
  my(check(p) = my(c=ellcard(E,p)); if(isprime(c),c,0));
  parforprime(p=2^n,,check(p),card,if(card,return([p,card])));
}
my(E=ellinit([1,3])); findp(E,80)
*/

inline(ell,ell2);
ell(a,B,N)=my(E=ellinit([0,0,0,a,1]*Mod(1,N))); ellpow(E,[0,1]*Mod(1,N),B);
ecm(N,t,B)=
  iferr(parvector(t,a,ell(a,B,N)),err,gcd(lift(component(err,2)),N),errname(err)=="e_INV");
ecm(2^101-1,500,600!)

ell2(a,B,N)=iferr(ell(a,B,N),err,return(gcd(lift(component(err,2)),N)),errname(err)=="e_INV");0;
ecm2(N,t,B)=my(z);parfirst(a->ell2(a,B,N),[1..t])[2];
ecm2(2^101-1,500,600!)
uninline();
inline(chkell);
chkell(n)=a->my(E=ellinit([1,0,0,0,ffgen(2^n)^a]),N=ellcard(E)/4);if(isprime(N),N);
ellp(n)=parfirst(chkell(n),[1..10000]);
ellp(128)
uninline();