Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9522

Incorrect parallel computation

From Yasha Gindikin <gindikin@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Incorrect parallel computation
Date 2012-04-08 08:17 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jlrhi8$eoe$1@smc.vnet.net> (permalink)

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Incorrect parallel computation Yasha Gindikin <gindikin@gmail.com> - 2012-04-08 08:17 +0000
  Re: Incorrect parallel computation David Bailey <dave@removedbailey.co.uk> - 2012-04-10 06:31 +0000
    Re: Incorrect parallel computation Yasha Gindikin <gindikin@gmail.com> - 2012-04-11 22:20 +0000
  Re: Incorrect parallel computation Zach Bjornson <bjornson@stanford.edu> - 2012-04-11 22:22 +0000

csiph-web