Use a raw device pointer for partialsum_storage.

Also implement adaptive greedy stuff.