MATLAB: Do I receive a “stack size error” when I attempt to start MATLAB 6.5 (R13) using the Load Sharing Facility (LSF) job management software

-xx:threadstacksize=8194javaMATLABnojvmsize;stackthreadthreadstacksize

I submitted a MATLAB job using the following LSF commands:
bsub -I -q asml_share 'ulimit -Ss 2097148;ulimit -Ss;matlab'
However, I receive the following error message in my terminal window:
Stack size of 2097152 Kb exceeds current limit of 2097148 Kb.
(Stack sizes are rounded up to a multiple of the system page size.) See
limit(1) to increase the stack size limit.
I tried increasing the "ulimit" parameter as suggested in Solution 1-1AOAX, but I am still unable to resolve this issue. I tried forcing the hardlimit to 2097148 and that did not work either.
Note that I am able to start MATLAB via LSF if I use the '-nojvm' switch.

Best Answer

You can resolve the stack size error by using the appropriate LSF commands in conjunction with the attached version of the java.opts file. Here are the required steps to download the java.opts file and submit a MATLAB job via LSF:
1. Download the attached file, java.opts. Place the file in the following directory:
$MATLAB\bin\$ARCH
(where $MATLAB is the MATLAB root directory on your machine, as returned by typing
matlabroot
at the MATLAB command prompt, and $ARCH is the architecture type for your processor.)
2. Start MATLAB as an LSF job, using the following command:
bsub -Is -q queue_name matlab