Slurm reads the submitted script and looks for directives beginning with #SBATCH, which the shell interprets as a comment, but Slurm uses to determine how what to allocate and for how long.
Simple job
Simplest job, using one core, and less than 6GB of memory. You can pass additional arguments on the sbatch command line, as well.
#!/bin/bash
#SBATCH --time=1:00:00
#SBATCH --nodes=2
#SBATCH --exclusive
# Note that mpiexec will pick up the node list and processor count from the environment.
# In most cases you should not be passing -np or any other parameters to mpiexec
mpiexec ./mpijob
Matlab Example
Running at MATLAB script using using just one node (note that -b takes a command, not a file; also some toolboxes may require the jvm, so you may not want the -nojvm option, but try it first).
When submitting a job array, each instance of the array runs independently. You use the environment variable SLURM_ARRAY_TASK_ID to determine which instance you are using.