0
ParallelTable[onePathList[s, parametri], {s, {1, 2, 3, 4}}]; // AbsoluteTiming

{14.771845, Null}

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

{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[σ_, params_] := 
With[{Tmax = params[[7]], dt = params[[8]]},
RandomFunction[proc[σ, params], {0, Tmax, dt}]["PathStates"]]

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

totForce[x_, t_, params_] := 
With[{a = params[[1]], 
b = params[[2]], \[ScriptCapitalA] = params[[3]], ω = 
params[[4]], α = params[[5]]}, (a x - 
b x^3 + \[ScriptCapitalA] Sin[ω t + α])]
LCarvalho
  • 9,233
  • 4
  • 40
  • 96
ac1965
  • 105
  • 6

1 Answers1

3

Use this

ParallelTable[onePathList[s, parametri], {s, {1, 2, 3, 4}}, DistributedContexts -> All];
molekyla777
  • 2,888
  • 1
  • 14
  • 28
  • This seems to do it thank you. I do not understand why it is needed, but frankly who cares... I am just happy that now it works [PS I understood that something like that is needed if the ParallelTable is inside the package, but this is not the case here... one hope that in next release they make it the default behaviour. God knows why it is not default now...] – ac1965 May 22 '14 at 13:20
  • 1
    @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
  • 1
    @Alberto Please take a look at sections 3.2 and 3.3 here. I tried to cover your issue in 3.3 and explain what's likely happening. – Szabolcs May 22 '14 at 13:36
  • thank you I will follow up. Am now going to post a really embarassing, rookie question on Plot colouring... – ac1965 May 23 '14 at 15:54