# ParallelTable not firing

In[42]:=
ParallelTable[onePathList[s, parametri], {s, {1, 2, 3, 4}}]; // AbsoluteTiming

Out[42]= {14.771845, Null}

In[43]:=
Table[onePathList[s, parametri], {s, {1, 2, 3, 4}}]; // AbsoluteTiming

Out[43]= {14.649838, Null}


I am also watching on the ParallelKernelStatus window and on the TaskManager (I am on a Windows 7 machine with 8 physical cores) and there is zero sign of the parallel kernel running. On the other hand, 4 of them do start up when evaluating the ParallelTable cell the first time. (I have default options in config, and limited to 4 cores by licence).

The function onePathList is defined in a package (see below for details) The vector "parametri" is a vector of real numbers, e.g. parametri={333.333,333.333,116.667,1,0,1,18,0.001}

Any help greatly appreciated, thanks

PS Function definitions from package

onePathList[\[Sigma]_, params_] :=
With[{Tmax = params[[7]], dt = params[[8]]},
RandomFunction[proc[\[Sigma], params], {0, Tmax, dt}]["PathStates"]]

proc[\[Sigma]_, params_] := With[{x0 = params[[6]]},
ItoProcess[{totForce[x, t, params], \[Sigma]}, {x, x0}, t]]

totForce[x_, t_, params_] :=
With[{a = params[[1]],
b = params[[2]], \[ScriptCapitalA] = params[[3]], \[Omega] =
params[[4]], \[Alpha] = params[[5]]}, (a x -
b x^3 + \[ScriptCapitalA] Sin[\[Omega] t + \[Alpha]])]

-
What values are in parametri? Could you give an example so that your code can be run? – Sjoerd C. de Vries May 21 '14 at 18:19
Did you see the following in 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." – Sjoerd C. de Vries May 21 '14 at 18:24
Your proc function uses undefined global variables x and t. – Sjoerd C. de Vries May 21 '14 at 18:36
As Sjoerd says, your code is incomplete, so we can't test it to see how it performs. Please post comlete code and read through this post. – Szabolcs May 21 '14 at 21:53
very useful link thank you – Alberto May 22 '14 at 13:27

ParallelTable[onePathList[s, parametri], {s, {1, 2, 3, 4}}, DistributedContexts -> All];

@Alberto The fact that DistributedContexts -> All seems to solve the problem here doesn't mean that it is a good default and that it can't bring other issues. If you have some of the functions defined in a package, I'd recommend you use ParallelNeeds to load the package into the subkernels instead. Distributing all contexts is a bit too uncomfortable for me since I don't know what's going on in all the contexts I did not create myself ... it's asking for trouble. – Szabolcs May 22 '14 at 13:30