Added a validation on CPU for the sorting results.