Re: Re: ParrallelDo and set::noval
- To: mathgroup at smc.vnet.net
- Subject: [mg102709] Re: [mg102697] Re: ParrallelDo and set::noval
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Thu, 20 Aug 2009 04:56:24 -0400 (EDT)
- References: <h63cgg$1b6$1@smc.vnet.net> <h6duf8$h1c$1@smc.vnet.net>
- Reply-to: drmajorbob at bigfoot.com
Since "immediate value" isn't a documented phrase, I'll be curious to see how anybody can decipher this. However... the chances are vanishingly small that ParallelDo will save you any time here, anyway. Bobby On Wed, 19 Aug 2009 06:02:55 -0500, guerom00 <guerom00 at gmail.com> wrote: > 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 :) > -- DrMajorBob at bigfoot.com