Login  Register

BitonicSort and RadixSortDemo

Posted by Rui Silva on Dec 17, 2010; 9:19pm
URL: https://forum.jogamp.org/BitonicSort-and-RadixSortDemo-tp2107372.html

Hello,

I am new to OpenCL and Jogamp. My problem is that when I try to change the size of the array in the examples BitonicSort and RadixSortDemo I always get an exception.

In BitonicSort if I change the following line of code from: "final int elements = 1048576;" to: "final int elements = 1048578;" I get the following exception:

Exception in thread "main" com.jogamp.opencl.CLException $ CLInvalidWorkGroupSizeException: can not enqueue 1DRange CLKernel [id: 1813676488 name: bitonicSortLocal1]
 with gwo: null GWS: 524289} {lws: {512}
cond.: null events: null [error: CL_INVALID_WORK_GROUP_SIZE]
        at com.jogamp.opencl.CLException.newException (CLException.java: 78)
        at com.jogamp.opencl.CLCommandQueue.putNDRangeKernel (CLCommandQueue.java: 1547)
        at com.jogamp.opencl.CLCommandQueue.put1DRangeKernel (CLCommandQueue.java: 1455)
        at com.jogamp.opencl.CLCommandQueue.put1DRangeKernel (CLCommandQueue.java: 1425)
        at com.jogamp.opencl.demos.bitonicsort.BitonicSort.bitonicSort (BitonicSort.java: 161)
        at com.jogamp.opencl.demos.bitonicsort.BitonicSort. <init> (BitonicSort.java: 73)
        at com.jogamp.opencl.demos.bitonicsort.BitonicSort.main (BitonicSort.java: 204)

In RadixSortDemo if I change the following line of code:

        from: "int [] runs = new int [] {32768,
                                       65536,
                                      131072,
                                      262144,
                                      524288,
                                     1048576,
                                     2097152,
                                     4194304,
                                     8388608}; "
        to: " int [] runs = new int [] {32768,
                                       65536,
                                      131072,
                                      262144,
                                      524288,
                                     1048576,
                                     2097152,
                                     4194304,
                                     8388606}; "
        I get the following exception:

Exception in thread "main" java.lang.RuntimeException
        at com.jogamp.opencl.demos.radixsort.Scan.scanExclusiveLarge (Scan.java: 61)
        at com.jogamp.opencl.demos.radixsort.RadixSort.radixSortStepKeysOnly (RadixSort.java: 103)
        at com.jogamp.opencl.demos.radixsort.RadixSort.radixSortKeysOnly (RadixSort.java: 87)
        at com.jogamp.opencl.demos.radixsort.RadixSort.sort (RadixSort.java: 75)
        at com.jogamp.opencl.demos.radixsort.RadixSortDemo. <init> (RadixSortDemo.java: 80)
        at com.jogamp.opencl.demos.radixsort.RadixSortDemo.main (RadixSortDemo.java: 131)

What am I doing wrong? I think that has to do with the size of localWorkSize and Size of the globalWorkSize but i do not understand how these values fit the new size of my array.

Thanks and regards
Rui Silva