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


Groups > comp.soft-sys.math.mathematica > #15972 > unrolled thread

Bug in ParallelDo?

Started byThomas Münch <thomas.muench@gmail.com>
First post2011-02-10 10:24 +0000
Last post2011-02-11 09:17 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Bug in ParallelDo? Thomas Münch <thomas.muench@gmail.com> - 2011-02-10 10:24 +0000
    Re: Bug in ParallelDo? "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-02-11 09:17 +0000

#15972 — Bug in ParallelDo?

FromThomas Münch <thomas.muench@gmail.com>
Date2011-02-10 10:24 +0000
SubjectBug in ParallelDo?
Message-ID<ij0ecn$9g8$1@smc.vnet.net>
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.


[toc] | [next] | [standalone]


#15992

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2011-02-11 09:17 +0000
Message-ID<ij2ur6$7ps$1@smc.vnet.net>
In reply to#15972
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...@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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web