Find the largest value in a float array and the index where it occurs, on the GPU, using a single block of threads that cooperates through shared memory.
Complete:
__global__ kernel launched as one block (a power-of-two size such as 256) that leaves the maximum and its index in device memory.void max_argmax(const float* x, int n, float* max_val, int* max_idx) where x is a host array of length n and max_val, max_idx are host pointers to single values. Allocate, copy in, launch, copy both results back and free.Do not write a main() in your solution.