Message Boards Message Boards

0
|
6176 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

WSMLink and ParallelTable

I (somewhat) understand how distribution works in parallelization. I would like to run WSMLink on multiple kernels, but I suspect that WSMLink makes calls to WSM and not to the Mathematica kernel. Is there a way to parallelize WSM? I tried DistributedContexts->"WSMLink`" but that didn't do it either.

If I explain my goal, someone will probably have a better idea of how to accomplish it. I know there is sensitive analysis in WSM, but I want to vary specific parameters in a well defined way. I'd like to run this parameter study by scripting instead of using a GUI. So in Mathematica I tried

parVals={1,2,3,4}; 
ParallelTable[WSMSimulate[myModel,WSMParameterValues->{component.parameter->val},{val,parVals}]

But that returns

WSMLink`WSMSimulate[myModel,WSMLink`MSMParameterValues->component.parameter->val},{val,parVals}]
POSTED BY: Eric Smith
4 Replies

Parallel parameter sweeps are actually built-in:

parVals={1,2,3,4}; 
WSMSimulate["myModel",WSMParameterValues->{"component.parameter" -> parVals}]

That will run simulations in parallel and return a list of simulation results.

Using the parallel Mathematica kernels (Parallelize, ParallelTable, ParallelEvaluate...) with WSMLink is not recommended. For starters, it would require every Mathematica slave kernel establishing a connection to SystemModeler.

The SystemModeler kernel cannot handle more than one request at the time, so the speedups are not likely to be significant. Also, a normal license only allows for one connection at a time between Mathematica/WSMLink <-> SystemModeler.

POSTED BY: Malte Lenz

Perfect! Thanks Malte.

With this information, can I confirm a couple things with you?

  1. Presumably I can set multiple parameters with Lists of the same length parsList={"component.parameter"->{1,2,3,4},"component.parameter1"->{2,3,4,5}}
  2. And hopefully I can mix scalars and lists parsList={"component.parameter"->{1,2,3,4},"component.parameter1"->2}
  3. And finally, what happens if my lists are unequal lengths? Will I get an error? parsList={"component.parameter"->{1,2,3,4},"component.parameter1"->{2,3}}
POSTED BY: Eric Smith
  1. Yes. In this case it will run four simulations.
  2. Yes. In this case it will run four simulations. "component.parameter1" will be 2 in all four simulations.
  3. Yes, this is an error. There is no straightforward way WSMSimulate could guess what you are trying to do, so you get:

    WSMSimulate::pil: There are WSMParameterValues and/or WSMInitialValues with different lengths. >>
    
POSTED BY: Malte Lenz

Great. I guess I could have ran those cases for myself, so I appreciate you responding so I didn't have to :)

POSTED BY: Eric Smith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract