Say I have a function f[x_,...]:=...
in a *.wl-Package form that depends on a bunch of Packages (some other *.wl files), and say I want to call this function f
several times in parallel. I am currently using a set-up of the following form
LaunchKernels[2];
ParallelNeeds["Privatef`",".../f_file.wl"];
ParallelTable[
output[i]=f[i];
,{i,1,10}];
where i
is just supposed to represent a set of parameters. The function f
itself is of the form
BeginPackage["Privatef`"]
f
Begin["fenv`"]
Needs["other Packages"]
some code
End[]
EndPackage[]
Now, my problem is that the function f
is distributed into the different subkernels I generated, though, the other Packages don't seem to load in each subkernel. I have tried to also use ParallelNeeds
on these additional Packages, but without success. So how do I get Mathematica to load each additional Package that f
requires in each subkernel that was launched?