Compute histogram with atomics.