So I was trying a very simple example (Mathematica 11.0.1)
AbsoluteTiming[
A1 = Table[
RandomReal[WorkingPrecision -> 30], {ii, 1, 1000}, {jj, 1,
1000}];]
{0.752044, Null}
And then in parallel
AbsoluteTiming[
A1 = ParallelTable[
RandomReal[WorkingPrecision -> 30], {ii, 1, 1000}, {jj, 1,
1000}];]
{6.35024, Null}
(which is after running it at least once so that definitions and stuff get distributed). It is clearly much slower than Table. This timing is independent of the number of kernels I launch - that is - it remains unchanged for LaunchKernels[n], where n is any integer different than 0 up to the maximum number of kernels I have (tried it on a machine with 12).
I also tried doing thing like
$MinPrecision = 30; $MaxPrecision = Infinity;
ParallelEvaluate[$MinPrecision = 30; $MaxPrecision =
Infinity;]; DistributeDefinitions[$MinPrecision, $MaxPrecision];
and then
AbsoluteTiming[
A1 = ParallelTable[
RandomReal[WorkingPrecision -> $MinPrecision], {ii, 1, 1000}, {jj,
1, 1000}];]
{6.38118, Null}
Which is again much slower than Table. I would like to know why is this happening, so that I can avoid this type of behaviour.
DistributeDefinitions, but that didn't work. – ThunderBiggi Mar 31 '17 at 11:24