printing cl_uint
I'm taking my first steps in OpenCL programming. I like it very much.
But I now have a small problem, I want to get solved. I'm trying to get the clock speeds of my CPU and GPU, using clGetDeviceInfo (currentDevice, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof(clockFrequency), clockFrequency, NULL); which, if I understand correctly, is the right manner to get that. And now I want to print it, using printf("The clock frequency is %d MHz\n", clockFrequency);
But that doesn't work. Thi开发者_如何学编程ngs I've tried so far: %d, %ld, %lld (you never know :P) %u, %lu, %llu, %i, %li, %lli but all doesn't work. There is also not much to find about it on our beloved friend Google.
This statement is in a loop, in which I also get the name of currentDevice. That is working, so I guess it's not a problem in the loop.
small edit: clGetDeviceInfo returns a cl_uint, which the attribute clockFrequency of course is
pfffft, another edit: the problem is thus that it is always printing 0, whatever I do...
100th edit: hey, it gives a C4022 - pointer mismatch for actual parameter 4. So there's something wrong with clockFrequency I guess? But what? I declared it as cl_uint clockFrequency = 0;
param_value is a pointer, so you have to pass a pointer:
&clockFrequency
精彩评论