Unify allocation code for CR_Socket and CR_Core

This makes --ntasks-per-socket also available for CR_Core.