Main Content

比较多个模拟工作流

运行一组多个模拟时,您可以在多个MATLAB上并行运行它们®平行游泳池的工人。要运行多个模拟,可以使用ParsimParsim'RunInBackground'选项打开,或Batchsim.

流程图显示了如何运行多种模拟ParsimParsimRuninBackground.andBatchsim.不同。

ParsimandBatchsim.commands use the Parallel Computing Toolbox™ license to run the simulations in parallel.Parsimruns the simulations in serial if a parallel pool cannot be created or if the Parallel Computing Toolbox license is not available.Batchsim.commands cannot run without Parallel Computing Toolbox license.

Parsim工作流程

使用Parsim使用并行计算工具箱的命令运行多个模拟自动设置并行池并并行运行模拟。客户总是与Matlab工人绑定。

BasicParsim工作流程

  1. 创建一个数组金宝appsimulink.simulationInput.对象,,指定模型的更改。

  2. Specify one-time setup required for running multiple simulations. You can usesetupfcn.andTransferBaseWorksPacevariables.在并行工作者上执行设置。

  3. Parsim(in)to execute these multiple simulations in parallel. If a parallel pool does not exist,Parsim创造它。Parsimuses default settings.

  4. You can open Simulation Manager by setting the'SimulationManager'argument to'在'ParsimParsim(in,'SimulationManager','on')。仿真管理器使您可以在运行时监视模拟,并在准备就绪时让您访问模拟的输出。Simulation Manager为您提供有关在工人上运行的模拟的信息。有关更多信息,请参阅Simulation Manager

  5. 一旦所有的模拟都完成,就会获得一系列金宝appsimulink.simulationOutput.对象。

Limitations

  • 关闭MATLAB会话终止在工人上的模拟,禁用部分结果检索。

ParsimRuninBackground.工作流程

  1. 创建一个数组金宝appsimulink.simulationInput.对象,,指定模型的更改。

  2. Specify one-time setup required for running multiple simulations. You can usesetupfcn.andTransferBaseWorksPacevariables.在并行工作者上执行设置。

  3. ParsimRuninBackground.选项设置为'在'Parsim(in,'RunInBackground','on')。设置'RunInBackground'option to'在'runs the simulations asynchronously. This keeps the MATLAB command prompt available enabling you to work on other tasks.

  4. 'RunInBackground'选项设置为'在'Parsim返回A.金宝appsimulink.simulation.future.目的。您可以调用此对象以检查模拟状态,在完成时获取模拟的输出,或取消模拟。有关更多信息,请参阅金宝appsimulink.simulation.future.

Limitations

  • 关闭MATLAB会话终止在工人上的模拟,禁用部分结果检索。如果是futureobject is cleaned, you are subsequently unable to access the results of the simulations.

  • 用一个fetchnext.方法循环Future对象,along with Simulation Manager causes them to compete for retrieval ofFuture对象。Use either afetchnext.method loop or Simulation Manager to get the outputs of completed simulations.

Batchsim.工作流程

批处理工作流程通常意味着提交作业以在MATLAB工作者上运行模拟,然后访问这些模拟的结果。在批处理运行模拟时,将模拟的执行卸载到计算群集中。要了解有关批处理的更多信息,请参阅Simple Batch Processing(并行计算工具箱)

  1. 创建一个数组金宝appsimulink.simulationInput.对象,,指定模型的更改。

  2. Specify one-time setup required for running multiple simulations. You can usesetupfcn.andTransferBaseWorksPacevariables.在并行工作者上执行设置。

  3. 在群集或桌面背景上运行,呼叫Batchsim.to offload the execution of simulations. WithBatchsim.,您可以使用兼容的大多数参数Parsimand命令。有关更多信息,请参阅Batchsim.

    使用Batchsim.,您将模拟卸载到Matlab工作者。要在多个工人上运行批处理作业,请指定池大小,N.,这是一个整数,指定工人的数量,为作业进行并行池:Batchsim.(in, 'Pool', N)。这re must be at leastn + 1群集可用的工人。如果未指定池大小,Batchsim.(in)在由默认群集配置文件指定的群集中的单个工作人员上运行模拟。

    笔记

    Batchsim.如果不可用池大小,则在池大小使用时出错。

  4. Batchsim.offloads simulations to the compute cluster, enabling you to carry out other tasks while the batch job is processing, or close the client MATLAB and access the batch job later.

  5. On submitting a batch job,Batchsim.返回包含作业ID的作业对象以及您可以用来稍后访问批处理作业的其他信息。再次访问此作业以检查模拟的进度。

Limitations

  • Because the client session is not tied to the workers, you cannot access the outputs unless the job is finished.

  • Batchsim.没有为您提供使用仿真管理器监视模拟的能力。对于批处理作业,您可以使用批处理作业监视器,该监视器告诉您作业是否排队,正在进行或已完成。有关更多信息,请参阅工作监视器(并行计算工具箱)

也可以看看

职能

课堂

Tools

Related Topics