CUDA: Getting max value and its index in an array

前端 未结 5 909
旧巷少年郎
旧巷少年郎 2021-01-03 01:57

I have several blocks were each block executes on separate part of an integer array. As an example: block one from array[0] to array[9] and block two from array[10] to array

5条回答
  •  心在旅途
    2021-01-03 02:39

    This will not benefit the original poster but for those who came to this page looking for an answer I would second the recommendation to use thrust that already has a function thrust::max_element that does exactly that - returns an index of the largest element. min_element and minmax_element functions are also provided. See thrust documentation for details here.

提交回复
热议问题