cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

spectral
Adept II
Adept II

Unable to fix a bug, '32 bits int' problems ?

Hi,

I'm working on the CLPP OpenCL Library and can't find a bug, so I request some engineering support from the OpenCL Intel Team... of course if possible.

The goal is to develop a radix-sort algorithm, the problem is that I'm unable to sort on 16 bits and 32 bits.
(All others are working fine).
So, my questions are :
1) does the OpenCL 'int' representation is different than the 'Win 7 64 bits' int ? (I think no !)
2) do I correctly generate random 'int' values for OpenCL ?
3) can you help me to fix it ? I'm searching to fix it since a long time !
BTW: The code is here http://code.google.com/p/clpp/
You can change the "bit" sorting parameter in 'benchmark.cpp'
Krys


Tags (1)
0 Kudos
Reply
5 Replies
MicahVillmow
Staff
Staff

Unable to fix a bug, '32 bits int' problems ?

viewon01,
OpenCL kernel 'int' data type is not guaranteed to be the same as 'int' on the host side. You must use 'cl_int' to get that gaurantee.
0 Kudos
Reply
spectral
Adept II
Adept II

Unable to fix a bug, '32 bits int' problems ?

Thanks Micah,

But then how can I generate cl_int random values ?

Does the way I do is correct ? Or how can I convert 'int' to 'cl_int' ?

The way I do is here (method makeRandomInt32Vector) :

http://code.google.com/p/clpp/source/browse/trunk/src/clpp/benchmark.cpp

0 Kudos
Reply
spectral
Adept II
Adept II

Unable to fix a bug, '32 bits int' problems ?

Notes that in my version I now use 'cl_int' and it is the same problem :(

0 Kudos
Reply
MicahVillmow
Staff
Staff

Unable to fix a bug, '32 bits int' problems ?

viewon01,
Make sure that any data that is used across host and device use cl_* types on the host side. If you can narrow your issue down to a small test case, we can investigate it and see if we can provide a fix.
0 Kudos
Reply
spectral
Adept II
Adept II

Unable to fix a bug, '32 bits int' problems ?

You can download the last SVN version of CLPP from here:

Just change PARAM_SORT_BITS to "32" (or 8,16,24) and run it.

You will see, the application will print in the console that the sorting has failed.

It is quite simple to reproduce. Tell me if you need something else ?

Thanks

0 Kudos
Reply