Hello

I’m porting an evolutionary optimization from the CPU to GPU. Everything works fine and very fast so far. But now I’ve a problem when sorting the result arrays.

I’ve 2 arrays. The first array is float2 and has 130.000 Elements, the second one is float and has 10.000 elements

```
float2 *a // 130K elements
float *b // 10K elements
```

Each element of array b belongs to 13 elements of array a.

(Array a contains 13 points of a Bezier based geometry, array b contains the calculatet area covert by this geometry - and I’ve to sort the bezier array by the best area values)

```
a[0] - a[12] -> b[0]
a[13] - a[25] -> b[1]
......
```

Now I’ve to sort both according to the value size of array b

```
b[0] = 4000;
a[0].x = 4.7;
...
a[12].x = 7.8;
b[1] = 3000;
a[13].x = 10.5;
...
a[25].x = 11.6;
b[2] = 5000;
a[26].x = 15.3;
...
a[38].x = 16.9;
// ---- sortet
b[0] = 5000;
a[0].x = 15.3;
...
a[12].x = 16.9;
b[1] = 4000;
a[13].x = 4.7;
...
a[25].x = 7.8;
b[2] = 3000;
a[26].x = 10.5;
...
a[38].x = 11.6;
```

I hope u understand what I mean.

I looked at the examples of radix and bitonic sort…I also checked gpuqsort. But all algorithmes only sort one list with standard datatypes by value.

My idea was to sort the float array and only save the sortet indecies into an new list. But my method (by reduction) only does 1024 elements. And 130K or at least 10K elements are far to much for shared memory.

Any further ideas?

It would also be possible to save both list in to one float3 array, if this would help.

Thx!