Difference between revisions of "MATLAB/Example"

From ScientificComputing
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
As an example for a MATLAB job, we are calculating the determinant of a 3x3 Matrix.
 
As an example for a MATLAB job, we are calculating the determinant of a 3x3 Matrix.
  
  [leonhard@euler01 ~]$ '''cat matrix_determinant.m'''  
+
  [sfux@eu-login-01-ng ~]$ '''cat matrix_determinant.m'''  
 
  A = [1 -2 4; -5 2 0; 1 0 3]
 
  A = [1 -2 4; -5 2 0; 1 0 3]
 
  d = det(A)
 
  d = det(A)
  [leonhard@euler01 ~]$ '''module load matlab/8.5'''
+
  [sfux@eu-login-01-ng ~]$ '''module load new matlab/9.1'''
  [leonhard@euler01 ~]$ '''bsub -n 1 -W 1:00 -R "rusage[mem=512]" "matlab -nodisplay -nojvm -singleCompThread -r matrix_determinant"'''  
+
  [sfux@eu-login-01-ng ~]$ '''bsub -n 1 -W 1:00 -R "rusage[mem=512]" "matlab -nodisplay -nojvm -singleCompThread -r matrix_determinant"'''  
 
  MATLAB job.
 
  MATLAB job.
 
  Job <30576749> is submitted to queue <normal.4h>.
 
  Job <30576749> is submitted to queue <normal.4h>.
  [leonhard@euler01 ~]$ '''bjobs'''
+
  [sfux@eu-login-01-ng ~]$ '''bjobs'''
 
  JOBID      USER        STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
 
  JOBID      USER        STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
  30576749  leonhard    PEND  normal.4h  euler01                *terminant Oct 21 13:32
+
  30576749  sfux        PEND  normal.4h  eu-login-01-ng          *terminant Oct 21 13:32
  [leonhard@euler01 ~]$ '''bjobs'''
+
  [sfux@eu-login-01-ng ~]$ '''bjobs'''
 
  JOBID      USER        STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
 
  JOBID      USER        STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
  30576749  leonhard    PEND  normal.4h  euler01                *terminant Oct 21 13:32
+
  30576749  sfux        PEND  normal.4h  eu-login-01-ng          *terminant Oct 21 13:32
  [leonhard@euler01 ~]$ '''bjobs'''
+
  [sfux@eu-login-01-ng ~]$ '''bjobs'''
 
  JOBID      USER        STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
 
  JOBID      USER        STAT  QUEUE      FROM_HOST  EXEC_HOST  JOB_NAME  SUBMIT_TIME
  30576749  leonhard    RUN  normal.4h  euler01    e1245       *terminant Oct 21 13:32
+
  30576749  sfux        RUN  normal.4h  eu-login-01-ng    e1245 *terminant Oct 21 13:32
  [leonhard@euler01 ~]$ '''grep -A9 "A =" lsf.o30576749'''  
+
  [sfux@eu-login-01-ng ~]$ '''grep -A9 "A =" lsf.o30576749'''  
 
  A =
 
  A =
 
   
 
   
Line 27: Line 27:
 
   
 
   
 
     -32
 
     -32
  [sfux@euler01 test1]$
+
  [sfux@eu-login-01-ng ~]$
  
 
The output of the MATLAB calculation can be found in the LSF log file <tt>lsf.o30576749</tt>.
 
The output of the MATLAB calculation can be found in the LSF log file <tt>lsf.o30576749</tt>.

Latest revision as of 06:37, 10 September 2019

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.