Running Matlab on the Grid
Running Matlab (interactively no GUI)
I’m looking into this issue. One thing I’ve noticed is that starting Matlab takes a long time on the grid. When I start Matlab with the following command:
bsub -q interactive -Is matlab -nodesktop -nojvm -nosplash
it takes about 45 seconds to start. If I tell Matlab where its license file is, it starts in about 5 seconds!
bsub -q interactive -Is matlab -nodesktop -nojvm -nosplash -c /usr/local/apps/matlab/matlab_2015a/licenses/network.lic
I’m hoping this license file trick will speed up the parpool initialization. I’ll let you know what I find.
Running a parallel loop
I’ve attached an example script to confirm that parfor works on the grid. Here are some timing results from this script:
Running sequential loop ...
Elapsed time is 23.157138 seconds.
Starting parallel pool (parpool) using the 'local' profile ... connected to 3 workers.
Elapsed time is 11.678452 seconds.
Running parallel loop ...
Elapsed time is 7.676729 seconds.
I ran this with three workers. The parallel loop is right around three times as fast as the sequential loop. Setting up the parallel pool takes a little while, but it’s sooooo much better than if I don’t tell Matlab where its license file is.
Here’s the bsub command I used to start an interactive Matlab session with 4 cores:
bsub -n 4 -q interactive -Is matlab -nodesktop -nosplash -c /usr/local/apps/matlab/matlab_2015a/licenses/network.lic
If you want to run with more processors replace “-n 4” with something like “-n 12”. Twelve is the max number of processors available. Let me know if you have any questions.
Requesting more memory
To specify the amount of memory use the -M flag:
bsub -n 4 -M 10240 -q interactive -Is matlab -nodesktop -nosplash -c /usr/local/apps/matlab/matlab_2015a/licenses/network.lic
Memory here is measured in megabytes, above I’m requesting 10 gigabytes. When submitting through bsub I’m not sure how much memory is requested by default, so it’s probably smart to use the -M flag whenever using bsub.