get the max of an C++ AMP array?

Nov 25, 2014 at 7:26 PM

I need to get the maximum element of a C++ AMP array:

float * myArrayCPU = ... ; // initialize an array on CPU
array <float, dims> myArray (e, myArrayCPU); // copy CPU data to GPU
...; // some calculation on GPU array
float maxElement = max(myArray); // get the maximum element of GPU array

Can this be done? I've heard this is about reduction and there is amp_stl_algorithms library on array_view but not sure if it applys on an C++ AMP array.
Dec 13, 2014 at 4:18 PM
I need something like this except the output I need is the index of the highest element rather than the element itself, so I can find the other data associated with the highest element.