Added proper support for slurm.
Merge pull request #938 from m214089/slurm

Added proper support for slurm.