Slurm can restrict jobs to their allocated resources using cgroups. To use cgroups you will have to configure the TaskPlugin cgroup option and specify how the cgroups should behave in cgroup.conf.

slurm.conf
cgroup.conf
ConstrainCores=yes

Regards,
--Megan