MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ParallelTable doesn't work, but Table does

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101741] Re: [mg101689] ParallelTable doesn't work, but Table does
  • From: Zach Bjørnson <bjornson at mit.edu>
  • Date: Wed, 15 Jul 2009 07:13:45 -0400 (EDT)
  • References: <200907140937.FAA01989@smc.vnet.net>

Hello-

The issue appears to be with your function definitions. Without having 
the code for the symbols that you distribute (Variable, JacobianMatrix, 
etc.), I tried this instead:

ParallelTable[
  a12*a13*a14*a21*a23*a24*a31*a32*a34*a41*a42*a43 + r2*r3*r4,

  {a12, 0, 0.01, 0.01}, {a13, 0, 0.01, 0.01}, {a14, 0, 0.01,
   0.01}, {a21, 0, 0.01, 0.01}, {a23, 0, 0.01, 0.01}, {a24, 0, 0.01,
   0.01}, {a31, 0, 0.01, 0.01}, {a32, 0, 0.01, 0.01}, {a34, 0, 0.01,
   0.01}, {a41, 0, 0.01, 0.01}, {a42, 0, 0.01, 0.01}, {a43, 0, 0.01,
   0.01}, {r2, 0.01, 0.02, 0.01}, {r3, 0.01, 0.02, 0.01}, {r4, 0.01,
   0.02, 0.01}
  ]

which worked. Sometimes there are issues with ParallelTable when 
parallel operations are relying on values maintained by other kernels 
(different iterators)--that's not the problem here evidently.

Check your DistributeDefinitions part. Have you distributed everything 
that the distributed functions rely on? E.g.

r[a_]:=a*a
b[d_]:=r[d]

DistributeDefinitions[b] won't work. You need
Distribute Definitions[b,r]

Try that...
cheers,
Zach

On 7/14/2009 5:37 AM, Iván Lazaro wrote:
> I'm having a problem using ParallelTable, but with Table there is no problem
> at all. The problem is that the calculation in Table is so long, so I think
> ParallelTable would make it faster.
>
> This is the code I parallelize:
>
>
> DistributeDefinitions[r, A, Variable, JacobianMatrix, CondIni, Ecua, Num,
> Time, Y, YI9]
>
> ParallelTable[
>
> J=JacobianMatrix[Ecua[r2,r3,r4,a12,a13,a14,a21,a23,a24,a31,a32,a34,a41,a42,a43],Variable[]];
>
> E1=Flatten[Transpose[J.Y]];
>
> EQ3=Table[D[Subscript[x, i][t],{t,1}]==
> Ecua[r2,r3,r4,a12,a13,a14,a21,a23,a24,a31,a32,a34,a41,a42,a43][[i]],{i,1,4}];
>
> EQ9=Table[D[Subscript[x, i][t],{t,1}]==E1[[i-4]],{i,5,20}];
>
> sol=NDSolve[Join[EQ9,EQ3,YI3,YI9],Table[Subscript[x,
> i][t],{i,1,20}],{t,0,Time},MaxSteps->  Infinity,AccuracyGoal->2];
>
> u=Table[Random[],{4}];
>
> PhiT=Transpose[Table[{Subscript[x, i][t],Subscript[x, i+4][t],Subscript[x,
> i+8][t],Subscript[x, i+12][t]},{i,5,8}]/.sol/.t->  Time];
>
> ExpLyap=Log[Norm[PhiT.u]]/Time,
>
> {a12,0,0.01,0.01},{a13,0,0.01,0.01},{a14,0,0.01,0.01},{a21,0,0.01,0.01},{a23,0,0.01,0.01},{a24,0,0.01,0.01},{a31,0,0.01,0.01},{a32,0,0.01,0.01},{a34,0,0.01,0.01},{a41,0,0.01,0.01},{a42,0,0.01,0.01},{a43,0,0.01,0.01},{r2,0.01,0.02,0.01},{r3,0.01,0.02,0.01},{r4,0.01,0.02,0.01}]
>
> If someone has an idea, i would apreciate it.
>
>
>    


  • Prev by Date: Re: ParallelTable doesn't work, but Table does
  • Next by Date: Re: Copy Greek text as Unicode?
  • Previous by thread: ParallelTable doesn't work, but Table does
  • Next by thread: Re: ParallelTable doesn't work, but Table does