Hello, I have three arrays of integers, one with all values, another where I keep the values resulting from the reduction of array0, and another that keeps the positions of the maximum values of the reduction of each warp but with reference to its position in array0
array0 → all values
array1 → maximum value for each warp
array2 → the position of each maximum value of each warp
example
array1[0] = 2234 → maximum value of a warp
array2[0] = 4 → the position of 2234 in array0
how save the maximum value and position at the same time?
this is my code:
for (int i=1; i<=width; i*=2) {
int n = __shfl_xor(value, i, width);
if (lane_id >= i && value<n) { value = n; }
}
if (threadIdx.x % warpSize == warpSize-1) {
maximums[warp_id] = value;
d_pos_out[warp_id] = positions[id];
}
values are saved correctly, but the positions do not match with the values
any idea?
many thanks