Scalability fix

will sort on host when gpu memory is not sufficient