Quantcast
Channel: Intel® Software - OpenCL*
Viewing all articles
Browse latest Browse all 1182

printf() with get_global_id uses wrong placeholder

$
0
0

Hi everyone,

I stumbled over a weird behavior that I cannot explain:

size_t global_work_sizes[2] = {1, 1};
ret = clEnqueueNDRangeKernel(command_queue, kernel, 2, NULL, global_work_sizes, NULL, 0, NULL, NULL); CHECK(ret);

__kernel void foo() {
    printf("global id %un", get_global_id(0));
        // returns global id 0
    printf("global size %un", get_global_size(0));
        // returns global size 1
    printf("global id: %u global size: %un", get_global_id(0), get_global_size(0));
        // returns global id: 0 global size: 0 - why is get_global_size(0) = 0?
    printf("global id: %u global size: %u unused var: %un", get_global_id(0), get_global_size(0));
        // returns global id: 0 global size: 0 unused var: 1 - where does that 1 come from?
    printf("%u %un", 0, 1);
        // return 0 1 - that is what I would be expecting
}

Am I missing something here?

Cheers,
Markus


Viewing all articles
Browse latest Browse all 1182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>