I am new to parallelization in Mathematica, so this question may reflect some elementary confusion. I am attempting to parallelize a rather complicated module which, as part of its internal operation, builds some tables. I ran into some mysterious-looking errors, and the code doesn't work. It turns out that the errors occur even when I try to run some very simple code:
K=3;
DistributeDefinitions[K];
ParallelEvaluate[Table[0, {i, 1, K}]]
I am using 2 parallel kernels, so I would expect this to generate the result
{{0, 0, 0}, {0, 0, 0}}
It actually does generate this result but it also generates errors:
(kernel 1) Table::iterb: Iterator {i,1,K} does not have appropriate bounds.
(kernel 2) Table::iterb: Iterator {i,1,K} does not have appropriate bounds.
I suppose that this means the parallel kernels are returning the command unevaluated, and then it's being evaluated by the master kernel before the output is printed. What's going on -- how can I get the parallel kernels to use the value of K?
I am using Mathematica 8.0.4.0. Thanks in advance for any insight!