Getting index and value of the second highest element of CuArray

For CuArray, say, A, we can use findmax(A) to find the value and index of the highest element efficiently. Is there a similar function that does for the second element? Thank you in advance for your help.

You can try partialsort!.

2 Likes