MATLAB/Example

From ScientificComputing
Jump to: navigation, search

As an example for a MATLAB job, we are calculating the determinant of a 3x3 Matrix.

[sfux@eu-login-01-ng ~]$ cat matrix_determinant.m 
A = [1 -2 4; -5 2 0; 1 0 3]
d = det(A)
[sfux@eu-login-01-ng ~]$ module load new matlab/9.1
[sfux@eu-login-01-ng ~]$ bsub -n 1 -W 1:00 -R "rusage[mem=512]" "matlab -nodisplay -nojvm -singleCompThread -r matrix_determinant" 
MATLAB job.
Job <30576749> is submitted to queue <normal.4h>.
[sfux@eu-login-01-ng ~]$ bjobs
JOBID      USER        STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
30576749   sfux        PEND  normal.4h  eu-login-01-ng          *terminant Oct 21 13:32
[sfux@eu-login-01-ng ~]$ bjobs
JOBID      USER        STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
30576749   sfux        PEND  normal.4h  eu-login-01-ng          *terminant Oct 21 13:32
[sfux@eu-login-01-ng ~]$ bjobs
JOBID      USER        STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
30576749   sfux        RUN   normal.4h  eu-login-01-ng    e1245 *terminant Oct 21 13:32
[sfux@eu-login-01-ng ~]$ grep -A9 "A =" lsf.o30576749 
A =

     1    -2     4
    -5     2     0
     1     0     3

d =

   -32
[sfux@eu-login-01-ng ~]$

The output of the MATLAB calculation can be found in the LSF log file lsf.o30576749.