Bill Allombert on Sat, 04 Feb 2012 15:58:00 +0100


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

parallel PARI


Dear PARI developers,

I have relased an experimental GIT branch 'bill-mt' which provide support for
parallel computation in GP. If you do not use GIT, you can download it at
<http://pari.math.u-bordeaux.fr/~bill/pari-mt-2.6-686-g83b6a71.tar.gz>

You need to pass an option to Configure as follow:
./Configure --mt=pthread

The following new experimental GP function are available:
parvector: like vector but the vector elements are computed in parallel:

? parvector(10,i,sin(i))
%2 = [0.84147098480789650665250232163029899963, 0.90929742682568169539601986591174484271, 0.14112000805986722210074480280811027985, -0.75680249530792825137263909451182909414, -0.95892427466313846889315440615599397335, -0.27941549819892587281155544661189475963, 0.65698659871878909039699909159363517794, 0.98935824662338177780812359824528867212, 0.41211848524175656975627256635243517934, -0.54402111088936981340474766185137728168]

parsum: like sum but the elements to sum are computed in parallel:
? parsum(i=1,10,sin(i))
%3 = 1.4111883712180104556285656374104180428

parapply: like apply but the evaluation are done in parallel:
? parapply(sin,vector(10,i,i))
%6 = [0.84147098480789650665250232163029899963, 0.90929742682568169539601986591174484271, 0.14112000805986722210074480280811027985, -0.75680249530792825137263909451182909414, -0.95892427466313846889315440615599397335, -0.27941549819892587281155544661189475963, 0.65698659871878909039699909159363517794, 0.98935824662338177780812359824528867212, 0.41211848524175656975627256635243517934, -0.54402111088936981340474766185137728168]

pareval: evaluate the elements of a vector of closures in parallel:
? pareval(vector(10,i,()->sin(i)))
%7 = [0.84147098480789650665250232163029899963, 0.90929742682568169539601986591174484271, 0.14112000805986722210074480280811027985, -0.75680249530792825137263909451182909414, -0.95892427466313846889315440615599397335, -0.27941549819892587281155544661189475963, 0.65698659871878909039699909159363517794, 0.98935824662338177780812359824528867212, 0.41211848524175656975627256635243517934, -0.54402111088936981340474766185137728168]

default(nbthreads): the number of child threads to use. The default is the number of core 
on you system.

NOTE:
- You cannot use global variables inside expression which are executed in parallel.
- You can use my() variables (but not local()) but changes will not propagate outside
  the expression.
- For indeterminate, use 'x instead of x (x is in fact a global variable with value 'x)
- gp-sta is 15% faster than gp-dyn with this patch.

I also provide MPI support (used on most clusters). You must run Configure as follow:
CC=mpicc ./Configure --mt=mpi
Currently, you must use gp-sta in preference of gp-dyn.
Generally mpi programs are run using mpirun -np N
where N is the number of core to use.
In that case, nbthreads default to N.

The interface is experimental and I like to hear about your experience using it.

Cheers,
Bill.