MathGroup Archive 2009

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

Search the Archive

Re: ParrallelDo and set::noval

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102697] Re: ParrallelDo and set::noval
  • From: guerom00 <guerom00 at gmail.com>
  • Date: Wed, 19 Aug 2009 07:02:55 -0400 (EDT)
  • References: <h63cgg$1b6$1@smc.vnet.net> <h6duf8$h1c$1@smc.vnet.net>

As requested, a minimal example which illustrate the problem.

The following sequential code works fine :

grid = Range[4, 50, 0.5];
testArray = Array[Null, {Length[grid]}];

Do[
 iroot = 0;
 rr = grid[[i]];
 Which[
  4 <= rr <= 50, iroot = 1
  ];
 testArray[[i]] = {i, iroot};
 , {i, 1, Length[grid]}]


The equivalent parallel code :

grid = Range[4, 50, 0.5];
testArray = Array[Null, {Length[grid]}];

DistributeDefinitions[grid,testArray];

ParallelDo[
 iroot = 0;
 rr = grid[[i]];
 Which[
  4 <= rr <= 50, iroot = 1
  ];
 testArray[[i]] = {i, iroot};
 , {i, 1, Length[grid]}]

returns "Set::noval: Symbol testArray in part assignment does not have
an immediate value." Somehow the DistributeDefinitions[] is not
sufficient to indicate to each kernel that I have initialized the list
testArray.

Thanks in advance for any help :)


  • Prev by Date: Re: Plot Table of functions does not distinguish colors
  • Next by Date: Re: Plot Table of functions does not distinguish colors
  • Previous by thread: Re: Re: ParrallelDo and set::noval
  • Next by thread: Re: Re: ParrallelDo and set::noval