Differences
This shows you the differences between two versions of the page.
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] ir | doku:matlab [2022/12/22 09:57] – Die Befehlszeile war nur nicht aktuell amelic | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Matlab | + | ====== Matlab |
==== Run Matlab Task from command line ==== | ==== Run Matlab Task from command line ==== | ||
- | Generate a matlab package called | + | Generate a matlab package called |
< | < | ||
add(2,3.4) | add(2,3.4) | ||
</ | </ | ||
- | and a function | + | and a function |
< | < | ||
z=x+y</ | z=x+y</ | ||
- | There are two ways to run this from the command line | + | Run this from the command line: |
- | option 1:< | + | |
- | / | + | |
- | option 2:< | + | |
- | / | + | |
- | + | ||
- | + | ||
- | ===== Batch Matlab job on VSC-3 ===== | + | |
- | In order to be able to use matlab, you have to load the program with the ' | + | |
< | < | ||
- | [username@l32]$ module avail # select a matlab version | ||
- | [username@l32]$ module load Matlab/ | ||
- | [username@l32]$ module list # check loaded modules | ||
- | Currently Loaded Modulefiles: | ||
- | 1) Matlab/ | ||
- | </ | ||
- | (See also the introduction to the [[https:// | ||
- | |||
- | Now, Matlab can be called by | ||
- | < | ||
- | [username@l32]$ matlab | ||
- | </ | ||
- | ==== Example: Serial Matlab Task ==== | ||
- | |||
- | We use the matlab m-file {{doku: | ||
- | < | ||
- | #!/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 | ||
- | #SBATCH -L matlab@vsc | ||
- | |||
module purge | module purge | ||
- | module load Matlab/v9.5_R2018b # load desired version | + | module load Matlab/(...Version...) |
- | + | matlab | |
- | export OMP_NUM_THREADS=1 | + | run test.m |
- | + | ||
- | time matlab | + | |
</ | </ | ||
- | < | + | ==== Further MATLAB Programs and batch jobs ==== |
- | [username@l32]$ sbatch jobSerial.sh | + | For more information in MATLAB programs |
- | [username@l32]$ squeue -u username | + | |
- | </ | + | |
- | ==== Example: Local Matlabpool | + | |
- | We use the same m-file '' | + | |
- | |||
- | |||
- | < | ||
- | #!/bin/bash | ||
- | # | ||
- | #SBATCH -J test # job name | ||
- | #SBATCH -N 1 # number of nodes | ||
- | #SBATCH --ntasks-per-node=16 | ||
- | #SBATCH --ntasks-per-core=1 | ||
- | #SBATCH --threads-per-core=1 | ||
- | #SBATCH --time=100 | ||
- | #SBATCH -L matlab@vsc | ||
- | |||
- | module purge | ||
- | module load Matlab/ | ||
- | |||
- | export OMP_NUM_THREADS=1 | ||
- | |||
- | time matlab < main.m | ||
- | </ | ||
- | |||
- | < | ||
- | [username@l32]$ sbatch jobPool.sh | ||
- | [username@l32]$ squeue -u username | ||
- | </ |