比较多个模拟工作流
运行一组多个模拟时,您可以在多个MATLAB上并行运行它们®平行游泳池的工人。要运行多个模拟,可以使用Parsim
那Parsim
和'RunInBackground'
选项打开,或Batchsim.
。
流程图显示了如何运行多种模拟Parsim
那Parsim
和RuninBackground.
andBatchsim.
不同。
这Parsim
andBatchsim.
commands use the Parallel Computing Toolbox™ license to run the simulations in parallel.Parsim
runs 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
工作流程
创建一个数组
金宝appsimulink.simulationInput.
对象,在
,指定模型的更改。Specify one-time setup required for running multiple simulations. You can use
setupfcn.
andTransferBaseWorksPacevariables.
在并行工作者上执行设置。跑
Parsim(in)
to execute these multiple simulations in parallel. If a parallel pool does not exist,Parsim
创造它。Parsim
uses default settings.You can open Simulation Manager by setting the
'SimulationManager'
argument to'在'
和Parsim
那Parsim(in,'SimulationManager','on')
。仿真管理器使您可以在运行时监视模拟,并在准备就绪时让您访问模拟的输出。Simulation Manager为您提供有关在工人上运行的模拟的信息。有关更多信息,请参阅Simulation Manager。一旦所有的模拟都完成,就会获得一系列
金宝appsimulink.simulationOutput.
对象。
Limitations
关闭MATLAB会话终止在工人上的模拟,禁用部分结果检索。
Parsim
和RuninBackground.
工作流程
创建一个数组
金宝appsimulink.simulationInput.
对象,在
,指定模型的更改。Specify one-time setup required for running multiple simulations. You can use
setupfcn.
andTransferBaseWorksPacevariables.
在并行工作者上执行设置。跑
Parsim
和RuninBackground.
选项设置为'在'
: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.和
'RunInBackground'
选项设置为'在'
那Parsim
返回A.金宝appsimulink.simulation.future.
目的。您可以调用此对象以检查模拟状态,在完成时获取模拟的输出,或取消模拟。有关更多信息,请参阅金宝appsimulink.simulation.future.
。
Limitations
关闭MATLAB会话终止在工人上的模拟,禁用部分结果检索。如果是
future
object 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(并行计算工具箱)。
创建一个数组
金宝appsimulink.simulationInput.
对象,在
,指定模型的更改。Specify one-time setup required for running multiple simulations. You can use
setupfcn.
andTransferBaseWorksPacevariables.
在并行工作者上执行设置。在群集或桌面背景上运行,呼叫
Batchsim.
to offload the execution of simulations. WithBatchsim.
,您可以使用兼容的大多数参数Parsim
and批
命令。有关更多信息,请参阅Batchsim.
。使用
Batchsim.
,您将模拟卸载到Matlab工作者。要在多个工人上运行批处理作业,请指定池大小,N.
,这是一个整数,指定工人的数量,为作业进行并行池:Batchsim.(in, 'Pool', N)
。这re must be at leastn + 1
群集可用的工人。如果未指定池大小,Batchsim.(in)
在由默认群集配置文件指定的群集中的单个工作人员上运行模拟。笔记
Batchsim.
如果不可用池大小,则在池大小使用时出错。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.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.
没有为您提供使用仿真管理器监视模拟的能力。对于批处理作业,您可以使用批处理作业监视器,该监视器告诉您作业是否排队,正在进行或已完成。有关更多信息,请参阅工作监视器(并行计算工具箱)
也可以看看
职能
Parsim
|Batchsim.
|批
(并行计算工具箱)|Parcluster.
(并行计算工具箱)|getsimulationJobs.