I am not sure what the best way is to extract the nonzero values of an integer device array A and place it into another device array B.
The pack intrinsic would be an obvious choice:
B(1:NNZ)=pack(A,mask=(A>0))
but it does not seem to work with device arrays.