fix --ntasks-per-socket with --cpus-per-task

Previous logic was counting CPUs, but assuming each task would
only use one CPU.
Pack cpus-per-task onto single socket

cpus-per-task support: Try to pack all CPUs of each tasks onto one socket.
Previous logic could spread the tasks CPUs across multiple sockets.
honor cpus_per_task with ntasks_per_core

Previous logic assumed cpus_per_task=1, so ntasks_per_core option
could spread the job across more cores than desired