Parellel Evaluation of Dynamic Content Within Dynamic Module
- To: mathgroup at smc.vnet.net
- Subject: [mg122706] Parellel Evaluation of Dynamic Content Within Dynamic Module
- From: "Dan O'Brien" <danobrie at gmail.com>
- Date: Mon, 7 Nov 2011 05:51:40 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Hello,
I'm wondering if there is a way to distribute the load of plotting a
fairly complex function within DynamicModule. The function has
dynamically updated parameters. A very simplified structure of my code
is something like:
DynamicModule[{parameters,dataset},
{Func[x_, i_, params_] :=
complicated function with dynamic parameters;
{Slider[Dynamic[parameter1]],
Slider[Dynamic[parameter2]](* ect ect....*)},
Map[Dynamic[
Show[{ListPlot[
dataset[[#]] (*data i'm trying to get good starting parameters \
for fitting*)], Plot[Func[x, #, parameters], {x, xLow, xHigh}]}]] &,
Range[number of datasets to fit]]},
Initialization -> {assign initial values and such}]
In reality the code depends on two packages I wrote which are loaded
prior to evaluating DynamicModule. It would be great if I could simply
replace Map with ParallelMap with all kernels loaded prior and contexts
distributed appropriately. However this does not seem to work, it is
obvious that when I change one of my sliders that is a parameter shared
across all data sets, each plot is evaluated sequentially and each takes
about 2-3 seconds to plot. From the documentation it looks like all
variables declared in DynamicModule are owned (and evaluated in?) the
frontend kernel... Does this deem parallel evaluation within the module
impossible?
Thanks
-Dan