我需要在我自己的 Java 应用程序中使用编译为 JAR 文件的 MATLAB 库。该库使用 parpool
并具有一些 parfor
运算符。我们可以使用 this example作为测试。
在 Windows 上它可以工作。在 Linux (Ubuntu xenial) 上,我得到类似 this 的错误但不一样:
Starting parallel pool (parpool) using the 'local_mcruserdata' profile ...
Error using parpool (line 104)
Failed to start a parallel pool. (For information in addition to the causing error, validate the profile 'local_mcruserdata' in the Cluster Profile Manager.)
Error in sample_pct (line 11)
Caused by:
Error using parallel.internal.pool.InteractiveClient>iThrowWithCause (line 666)
Failed to initialize the interactive session.
Error using parallel.internal.pool.InteractiveClient>iThrowIfBadParallelJobStatus (line 767)
The interactive communicating job failed with no message.
The error is com.mathworks.toolbox.javabuilder.MWException: Failed to start a parallel pool. (For information in addition to the causing error, validate the profile 'local_mcruserdata' in the Cluster Profile Manager.)
我的 MATLAB 是 9.2.0.538062 (R2017a),我的 JDK 在两个系统上都是 1.8.0_171 x86_64。
如果我注释第 11 行(parpool 函数调用),错误就会消失,但 parfor 运算符不会创建额外的 worker。
这是一个已知的错误吗?可以修复吗?
最佳答案
添加后setSchedulerMessageHandler(@disp); setenv('MDCE_DEBUG','true')
示例(正如评论中所建议的那样)我收到了消息:
matlabroot/bin/glnxa64/ctfxlauncher:加载共享库时出错:libmwmclmcrrt.so.9.2:无法打开共享对象文件:没有这样的文件或目录
find matlabroot -name libmwmclmcrrt.so.9.2
给出 matlabroot/runtime/glnxa64/libmwmclmcrrt.so.9.2
将 matlabroot/runtime/glnxa64
目录添加到 LD_LIBRARY_PATH
有帮助!
关于java - 在 Linux 上从 Java 使用 Matlab parpool 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51194780/