ParseError: syntax error, unexpected 'include' (T_INCLUDE), expecting identifier (T_STRING) or '{'
meta data for this page
- Česky (cs)
- English (en)
ParseError: syntax error, unexpected 'include' (T_INCLUDE), expecting identifier (T_STRING) or '{'
Matlab
Simple examples for running Matlab tasks can be found in the /home/SOFT/modules/examples/Matlab/ directory, which you can copy to your own using:
cp -r /home/SOFT/modules/examples/Matlab/ ./
In the single directory there are two files, the Matlab script „montecarlo_single.m“ and the script for sbatch „slurm.sh“. By typing
cd single sbatch slurm.sh
will start a program on the queue system on a single core that takes about 20-40s to run (kraken-m1,…-m6 machines are faster on this job).
There is a similar example in the „parallel“ directory for a job parallelized over 8 cores within a single node. The script for sbatch is:
#!/bin/bash #SBATCH -J example_matlab #SBATCH -N 1 #SBATCH -n 8 #SBATCH --time=2:00 #SBATCH -o slurm.%N.%J.%u.out # STDOUT #SBATCH -e slurm.%N.%J.%u.err # STDERR matlab -nodisplay -r "montecarlo_parallel;quit;"
Running a Matlab job across multiple nodes is not possible because the „Matlab Parallel Server“ is not purchased. Therefore, you must always keep the option in the startup script
#SBATCH -N 1
Parallel task: parpool
Parallel methods in Matlab programs are initialized with the „parpool“ function. In our setup, a program using 8 cores must contain
parpool('local', 8);
However, automaticall loading of the number of cores allocated by Slurm is possible and recommended for beginers. Slurm stores the value defined by „#SBATCH -n“ in the system variable „SLURM_NTASKS“, which Matlab can read
sz = str2num(getenv('SLURM_NTASKS'));
parpool('local',sz);