# correct usage of ParallelTable

I am trying to parallelize my script. Here is a MWE of how I have done it:

LaunchKernels[2];

container = {};
SetSharedVariable[container];

fun[x_] := 2*x;
container = ParallelTable[{i, fun[i]}, {i, 1, 3}];


I am unsure if this is done correctly. There are mainly two things I am concerned about when using ParallelTable:

1. Is it necessary to parallelize the expression to be looped, i.e. fun?
2. Is it necessary to make the container with the ParallelTable-results a shared variable?
-
1. I believe in the most recent versions not necessary 2. No, don't do it as you did. This is only necessary for variables that you want to have shared during the parallel calculations. –  Sjoerd C. de Vries Jun 3 '13 at 21:29
@SjoerdC.deVries Adding to 1. From the documentation: "The default value is DistributedContexts:>$DistributedContexts with $DistributedContexts:=\$Context, which distributes definitions of all symbols in the current context, but does not distribute definitions of symbols from packages." So you are right! –  sebhofer Jun 4 '13 at 9:22