Linux (6) OpenCV (4) Deep Learning (3) MATLAB (3) Mac OS X (3) Windows (2) C# (1) Node JS (1)

2013年6月9日 星期日

Using MATLAB Local Parallel Computing Toolbox

MATLAB Parallel Computing Toolbox can automatically divide tasks of for loop and run multiple instances simultaneously. Just use the "parfor" keyword and MATLAB will do the rest work. However, we usually need to configure MATLAB to make this feature work. The configuration is located at:
Menu -> Parallel -> Manage Configurations...

The common two issues that prevent running parallel computing are:
1. Unresolved hostname
=> MATLAB use TCP/IP and hostname to connect to clients. Please make sure your hostname mapping is set in /etc/hosts. Use command !hostname in MATLAB to check your hostname

2. Data Location is not set
=> To set data exchange location, open Menu -> Parallel -> Manage Configurations..., select the local profile,  Property... -> set "Folder where Job data is stored (DataLocation)" to [your location] (e.g. /tmp/MATLAB)

Other problems include no license of Parallel Computing Toolbox, check it by typing command:
license checkout Distrib_Computing_Toolbox
Or problem of local mpiexec
If you are using R2010a or newer, you may experience issues with the new local mpiexec implementation. In that case, try the following command to disable this feature:
distcomp.feature( 'LocalUseMpiexec', false )
Refer to for more information

Moreover, MAC user may encounter the error below:
The class distcomp.typechecker has no property or method named 'getDefaultValue'.

Error in distcomp.configsection (line 50)
    obj.PropValue{i} = distcomp.typechecker.getDefaultValue(obj.Types{i});

This is a known bug of MATLAB with Java version. Please refer to MATLAB official site:

Bug 919688


Parallel Computing Toolbox code fails with Java Virtual Machine update 1.6.0_39


Running any Parallel Computing Toolbox code using a Java Virtual Machine (JVM) version of 1.6.0_39 or later might cause a NullPointerException to be thrown by the JVM. For example:....

Follow the instruction on MATLAB, download the JVM and update it. Be careful not to overwrite other files under MATLAB folder!