MathGroup Archive 2012

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

Search the Archive

Incorrect parallel computation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125939] Incorrect parallel computation
  • From: Yasha Gindikin <gindikin at gmail.com>
  • Date: Sun, 8 Apr 2012 04:16:00 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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