You are here: UTSA Research Support Group>Main Web>SoftwareAndApplications>Matlab (23 Mar 2017, AdminUser)Edit Attach

[abc123@login-0-0 ~]$ qlogin [abc123@compute-0-3 ~]$ module load matlab/2015a [abc123@compute-0-3 ~]$ matlab -nojvm -nodisplay |

`qlogin`

, we are asking SGE to log us in to any remote machine that is currently unloaded. We then get a prompt on some remote machine and we can then run Matlab by loading the module. The '`-nojvm`

' and '`-nodisplay`

' options turn off all the graphics since they wil probably not work smoothly over the network anyway.
MAKE SURE that you quit from Matlab and exit from the `qlogin`

shell (your prompt should go back to something like `qlogin`

, SGE will assume that you are making use of 1 CPU and may not schedule other jobs onto it.
This may be a preferred way to run interactive Matlab jobs since a low-priority interactive job could be squashed by someone else's high-priority job, leading to very slow response times and a frustrating interactive experience.
`qsub`

. A simple script might look like:
#!/bin/bash # #$ -S /bin/bash -cwd #$ -o matlab.out -j y #$ -l mem_free=1.0G . /etc/profile.d/modules.sh module load matlab/2015a matlab -nojvm -nodisplay -r my_matlab_program |

`-S`

'), where to put screen output ('`-o`

'), etc.
One quirk worth noting is that in an SGE script, Matlab needs to be called with the '`-r`

' option which tells it to immediately run an m-function instead of presenting an interactive prompt to the user - if you forget the '`-r`

', then your Matlab job will "run" and tie up resources for ever (since you don't have interactive access and cannot tell it to exit). Note that the script is in a file called "my_matlab_program.m" (with a ".m" extension), but the Matlab executable is called with "my_matlab_program" (withOUT the ".m" extension).
Now submit the above job with qsub:
[abc123@login-0-0 ~]$ qsub myprogram.qsubIt is EXTREMELY IMPORTANT that your Matlab script call the '

`quit`

' command at the end of it's processing or else it will run forever!
`#$ -pe threaded` `4` |

matlab -nojvm -nodisplay -r "maxNumCompThreads=$NSLOTS;my_matlab_program;quit" |

Edit | Attach | Print version | History: r2 < r1 | Backlinks | View wiki text | Edit wiki text | More topic actions

Topic revision: r2 - 23 Mar 2017, AdminUser

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Ideas, requests, problems regarding UTSA Research Support Group? Send feedback

Ideas, requests, problems regarding UTSA Research Support Group? Send feedback