MATLAB Answers

0

Using parsim, where do the executables go?

Asked by Arvid Keemink on 14 Dec 2018
Latest activity Edited by Rahul Kumar on 10 Jan 2019
Hi,
Context: I would like to run an elaborate SLX model in parallel with parsim for numeric optimization (evolution) with approximately changing 100 parameters, with rapid accelerator mode. I tried this Mathworks Example in Matlab 2017b and this works fine. I get the results, and I can use those results to determine new parameters, and call another parsim with new params, and another etc. for each 'generation' of the evolutionary optimization.
However, what takes up so much time is the setup function that needlessly (re)builds the model every time I call parsim, because of
Simulink.BlockDiagram.buildRapidAcceleratorTarget(modelname);
But if I don't build the r.a. target in the setup function, all simulation-runs will fail with error: 'Executable not found.'.
Question: I cannot find the(se) executable(s) anywhere, how can I force the system to keep them/it such that the next parsim call can immediately reuse them/it?
An alternative would be that parsim just keeps running (waiting) indefinitely and I never have to recall it, and I append new simulations to some job queue, but then I need to read-out outputdata from N simulations that just finished. I don't know if this is even possible.
Any other methods to achieve the same are also welcome. I first tried this through parfor, but get confused with all the workspaces and annoyed that it build N times for N workers.

  0 Comments

Sign in to comment.

1 Answer

Answer by Rahul Kumar on 10 Jan 2019
Edited by Rahul Kumar on 10 Jan 2019

Hi Arvid,
Try building the model locally, i.e. run Simulink.BlockDiagram.buildRapidAcceleratorTarget(modelname); on your "host" MATLAB session before calling parsim. You will notice that the build process generates a Simulink Cache file (slxc). If the architecture of the parallel workers is the same as that of the host (which is always true if you are using a 'local' pool of workers). parsim will send that slxc file over to the workers and even though the SetupFcn will call the rebuild, it will just skip the actual build. If you parallel worker is a different architecture then you will have to generate the slxc file for that architecture and copy it over to host machine.
Please try it out and let me know if you run into any issues.

  0 Comments

Sign in to comment.