我有一个令人尴尬的并行工作,不需要工人之间的沟通。我正在尝试使用 dfeval 函数,但开销似乎很大。首先,我正在尝试运行文档中的示例。
>> matlabpool open
Starting matlabpool using the 'local' configuration ... connected to 8 labs.
>> sched = findResource('scheduler','type','local')
sched =
Local Scheduler Information
===========================
Type : local
ClusterOsType : pc
ClusterSize : 8
DataLocation : C:\Users\~\AppData\Roaming\MathWorks\MATLAB\local_scheduler_data\R2010a
HasSharedFilesystem : true
- Assigned Jobs
Number Pending : 0
Number Queued : 0
Number Running : 1
Number Finished : 8
- Local Specific Properties
ClusterMatlabRoot : C:\Program Files\MATLAB\R2010a
>> matlabpool close force local
Sending a stop signal to all the labs ... stopped.
Did not find any pre-existing parallel jobs created by matlabpool.
>> sched = findResource('scheduler','type','local')
sched =
Local Scheduler Information
===========================
Type : local
ClusterOsType : pc
ClusterSize : 8
DataLocation : C:\Users\~\AppData\Roaming\MathWorks\MATLAB\local_scheduler_data\R2010a
HasSharedFilesystem : true
- Assigned Jobs
Number Pending : 0
Number Queued : 0
Number Running : 0
Number Finished : 8
- Local Specific Properties
ClusterMatlabRoot : C:\Program Files\MATLAB\R2010a
>> tic;y = dfeval(@rand,{1 2 3},'Configuration', 'local');toc
Elapsed time is 4.442944 seconds.
运行后续时间会产生类似的时间。所以我的问题是:
- 鉴于我在新实例中运行 matlabpool open,为什么我需要运行 matlabpool close force local 以使 Number Running 为零?
- 对于这样一个微不足道的例子,真的需要 5 秒的开销吗?特别是考虑到 Matlab 工作人员已经启动?