可以并行使用Win32 :: OLE来启动Matlab的多个实例吗? [英] Can Win32::OLE be used in parallel to start multiple instance of Matlab?
问题描述
当 Parallel::Loops
与
When Parallel::Loops
is combined with Win32::OLE
to create multiple instance of Matlab, if we use
my $ML = Win32::OLE->new('Matlab.Application') or die "Cannot start MATLAB"
在每个循环中,程序崩溃并显示未处理的异常.
in each loop, the program crashes showing an unhandled exception.
如果将my
放在$ML
之前,则它可以工作,但是在任何时候,只有一个实例在运行.
If drop the my
before $ML
then it works, but at any time only one instance is running.
推荐答案
我不确定在并行循环中创建多个MATLAB COM服务器有什么好处.
I'm not sure what is the benefit of creating multiple MATLAB COM servers in a parallel loop.
默认情况下,服务器以共享模式创建,即被所有实例共享. MATLAB引擎以单线程方式显示给用户,因此在您的情况下,所有客户端计算都以串行方式而不是并行方式运行.
By default the server is created in shared mode, ie shared by all instances. The MATLAB engine is exposed to the user as single-threaded, so in your case all the clients computations are run in serial, not in parallel.
幸运的是,您以专用模式创建了MATLAB COM服务器:
Fortunately you create MATLAB COM server in dedicated mode:
Win32::OLE->new('Matlab.Application.single')
请参见此页面了解更多信息
PS:我对Perl知之甚少:)
PS: I know very little Perl :)
这篇关于可以并行使用Win32 :: OLE来启动Matlab的多个实例吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!