- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The attached simple program simply prints out the result of get_local_id(0) and get_global_id(0). The former works but the latter returns 0 every time. Here is the output:
Device name: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
Driver version: 1.2.0.76921
local_id = 0 global_id = 0
local_id = 1 global_id = 0
local_id = 2 global_id = 0
local_id = 0 global_id = 0
local_id = 1 global_id = 0
local_id = 2 global_id = 0
I'm using Ubuntu 13.10 on Sandy Bridge and I installed from intel_sdk_for_ocl_applications_xe_2013_r2_runtime_3.1.1.11385_x64.tgz. I realise this is probably not a supported platform, but perhaps someone from Intel could run the code and see whether the problem is reproducible (g++ -Wall -g -o printf-test printf-test.cpp -lOpenCL).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. I realized what is the problem.
get_global_id and get_local_id return size_t which is I support 64-bit values on your device.
If you replace %d in your string with %ul, you should get correct output.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bruce,
I was able to reproduce your results. Thanks for reporting it!
But I think it's an issue with printf function rather than get_global_id.
I switched get_global_id and get_local_id calls and get the correct results for get_global_id:
global_id = 0 local_id = 0
global_id = 1 local_id = 0
global_id = 2 local_id = 0
global_id = 3 local_id = 0
global_id = 4 local_id = 0
global_id = 5 local_id = 0
It looks like there is a problem with printing a second value.
Thanks, Aleksey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. I realized what is the problem.
get_global_id and get_local_id return size_t which is I support 64-bit values on your device.
If you replace %d in your string with %ul, you should get correct output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're right, using the correct size modifier made it work. I'll go back to the original code I was trying to debug and see if I can make progress there. Thanks for the help.
It might be nice if future versions of the compiler gave a warning when the specifier and argument don't match, similar to the way GCC does.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page