Troubles with running radix sort demo

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Troubles with running radix sort demo

Andrew
Hi! I just faced a strange problem running radix sort demo. It compiles properly, without any warnings in CL kernels, but execution produces incorrect results. These results look like they've undergone data races or incorrect bit operations -- for example (for maxValue = 10), the program outputs the following:

 = = = workgroup size: 128 = = =
array size: 0.131072MB; elements: 32K
snapshot before sorting: 0, 3, 8, 4, 0, 5, 5, 8, 9, 3, 2, 2, 6, 2, 6, 2, 6, 0, 3, 9, ...; 32748 more
time: 6.600048ms
time: 5.044378ms
time: 4.78385ms
time: 4.060292ms
time: 3.898054ms
time: 3.924897ms
time: 3.750422ms
time: 5.213722ms
time: 4.366611ms
time: 4.253321ms
snapshot: 0, 0, 2, 4, 7, 0, 0, 13, 0, 0, 2, 4, 7, 0, 0, 13, 0, 0, 0, 0, ...; 32748 more
validating...
Exception in thread "main" java.lang.RuntimeException: not sorted 7 !> 0

The set looks sorted only partially, like when data races occur. Furthermore, I presume that no numbers greater than 9 could appear in data set during normal execution. I tried -Werror and -cl-opt-disable for CL builds, but this doesnt help -- nor the problem disappears, neither the builds fall with errors. Could someone please help me with this issue?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Troubles with running radix sort demo

Wade Walker
Administrator
I've noticed in the past that this demo doesn't give correct results when run on AMD hardware. I worked on it for a while to try to isolate the problem, but I was unsuccessful. Apparently the code makes some assumption about the underlying architecture which is valid for Nvidia but not AMD. If you happen to find the problem, I'd gratefully accept a patch!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Troubles with running radix sort demo

Andrew
Thanks for reply! I'll try to fix this demo and will open a pull request on github in case of success.
Loading...