Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Bug in ParallelDo?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116340] Re: Bug in ParallelDo?
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Fri, 11 Feb 2011 04:17:00 -0500 (EST)
  • References: <ij0ecn$9g8$1@smc.vnet.net>

Looks like a bug to me, though it works if you use a shared variable:

test = {0, 0};
SetSharedVariable[test];
ParallelDo[(test[[i]] = {$KernelID,
     RandomVariate[\[ScriptCapitalD]]}) // Print, {i, 2}]

So, I don't think the kernels don't see the definition.

Cheers -- Sjoerd

On Feb 10, 11:24 am, Thomas M=FCnch <thomas.mue... at gmail.com> wrote:
> Is this a bug in ParallelDo? The parallel Kernels do not seem to see the
> definitions propely.
>
> LaunchKernels[]
> \[ScriptCapitalD] = SmoothKernelDistribution[{1, 2, 3, 4}]
> DistributeDefinitions[\[ScriptCapitalD]]
> Print@"Table:"
> Table[{$KernelID,RandomVariate[\[ScriptCapitalD]]}, {2}] (* This is fine *)
> Print@"Do:"
> Do[Print@{$KernelID,RandomVariate[\[ScriptCapitalD]]}, {2}] (* This is
> fine *)
> Print@"ParallelTable:"
> ParallelTable[{$KernelID,RandomVariate[\[ScriptCapitalD]]}, {2}] (* This
> is fine *)
> Print@"ParallelDo:"
> ParallelDo[Print@{$KernelID,RandomVariate[\[ScriptCapitalD]]}, {2}] (*
> This is NOT fine *)
>
> This is Mathematica V8 on Windows XP, machine with 4 Cores. I have
> reported this to TechSupport.



  • Prev by Date: Re: Integrate this how?
  • Next by Date: Re: Bug in ParallelDo?
  • Previous by thread: Bug in ParallelDo?
  • Next by thread: Re: Bug in ParallelDo?