A lot of scientific software, codes or libraries can be parallelized via MPI or OpenMP/Multiprocessing.
Avoid submitting inefficient Jobs!
If your code can be parallelized only paritially (serial parts remaining), familiarize with Amdahl's law and make sure your Job efficiency is still well above 50%.
Default Values
Slurm parameters like --ntasks and --cpus-per-task default to 1 if omitted.
However, when omitting these Slurm parameters, their corresponding environment variables SLURM_NTASKS and SLURM_CPUS_PER_TASK will not be populated. For this reason you will find export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1} in most job templates which sets OMP_NUM_THREADS=1 if SLURM_CPUS_PER_TASK is not defined.