MathGroup Archive 2012

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

Search the Archive

Incorrect parallel computation


Dear colleagues,

would you please advise me on why the following simple code executes incorrectly when parallelized?

a = Subsets[Range[1, 5], {3}];
L = Length@a;
b = Table[0, {5}];
c = Table[0, {5}];
SetSharedVariable[c];
Do[b[[a[[l, k]]]] += 1, {l, L}, {k, 3}];
ParallelDo[c[[a[[l, k]]]] += 1, {l, L}, {k, 3}];
b===c

False

Thank you!
Best regards,
Yasha Gindikin.



  • Prev by Date: Varying a constant in an ODE to Manipulate solution set
  • Next by Date: Re: Graphics3D and transparent background
  • Previous by thread: Re: Varying a constant in an ODE to Manipulate solution
  • Next by thread: Re: Incorrect parallel computation