Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
doku:matlab [2020/01/16 10:54] – [Example: Serial Matlab Task] irdoku:matlab [2022/12/22 09:57] – Die Befehlszeile war nur nicht aktuell amelic
Line 1: Line 1:
-====== Matlab Batch Jobs ======+====== Matlab VSC ======
  
 ==== Run Matlab Task from command line ==== ==== Run Matlab Task from command line ====
  
-Generate a matlab package called //test.m//,+Generate a matlab package called ''test.m'',
 <code> <code>
 add(2,3.4) add(2,3.4)
 </code> </code>
-and a function //add.m//,+and a function ''add.m'',
 <code>function z=add(x,y) <code>function z=add(x,y)
 z=x+y</code> z=x+y</code>
-There are two ways to run this from the command line +Run this from the command line:
-option 1:<code> +
-/opt/sw/matlab-80/bin/matlab -nodisplay < test.m</code> +
-option 2:<code> +
-/opt/sw/matlab-80/bin/matlab -nodisplay -r  "add(2,3.4)"</code> +
- +
- +
-===== Batch Matlab job on VSC-3 =====  +
-In order to be able to use matlab, you have to load the program with the 'module load xyz' command+
 <code> <code>
-[username@l32]$ module avail  # select a matlab version 
-[username@l32]$ module load Matlab/v8.5_R2015a # load desired version 
-[username@l32]$ module list   # check loaded modules 
-Currently Loaded Modulefiles: 
-  1) Matlab/v9.5_R2018b     
-</code> 
-(See also the introduction to the [[https://wiki.vsc.ac.at/doku.php?id=doku:slurm|module command.]]) 
- 
-Now, Matlab can be called by 
-<code> 
-[username@l32]$ matlab   
-</code> 
-==== Example: Serial Matlab Task ==== 
- 
-We use the matlab m-file {{doku:myplot.m|myplot.m}} and create a file called ''jobSerial.sh'' as your job script, with the following basic contents: 
-<code> 
-#!/bin/bash 
-# 
-#SBATCH -J test                     # job name 
-#SBATCH -N 1                        # number of nodes 
-#SBATCH --ntasks-per-node=1        
-#SBATCH --ntasks-per-core=1 
-#SBATCH --threads-per-core=1 
-#SBATCH --time=10                   # run time unit=minutes 
-#SBATCH -L matlab@vsc 
- 
 module purge module purge
-module load Matlab/v9.5_R2018b # load desired version +module load Matlab/(...Version...) 
- +matlab -nodisplay 
-export OMP_NUM_THREADS=1 +run test.m
- +
-time matlab < myplot.m+
 </code> </code>
  
-<code> +==== Further MATLAB Programs and batch jobs ==== 
-[username@l32]$ sbatch jobSerial.sh   # submit your job +For more information in MATLAB programs and batch jobs<html><b><font color=#cc3300> read here &#8611;</b></font></html>[[https://colab.tuwien.ac.at/display/IAVSC/MATLAB|TUCOLAB]] 
-[username@l32]$ squeue -u username    # check state of your job +
-</code> +
-==== Example: Local Matlabpool ==== +
-We use the same m-file ''main.m'' as done for VSC-2 and create the following shellscript ''jobPool.sh''+
  
- 
- 
-<code> 
-#!/bin/bash 
-# 
-#SBATCH -J test                     # job name 
-#SBATCH -N 1                        # number of nodes 
-#SBATCH --ntasks-per-node=16        # here we use all 16 cores of the node 
-#SBATCH --ntasks-per-core=1 
-#SBATCH --threads-per-core=1 
-#SBATCH --time=100                   # run time unit=minutes 
-#SBATCH -L matlab@vsc 
- 
-module purge 
-module load Matlab/v9.5_R2018b # load desired version 
- 
-export OMP_NUM_THREADS=1 
- 
-time matlab < main.m 
-</code> 
- 
-<code> 
-[username@l32]$ sbatch jobPool.sh     # submit your job 
-[username@l32]$ squeue -u username    # check state of your job 
-</code> 
  • doku/matlab.txt
  • Last modified: 2024/07/05 07:19
  • by grokyta