haochunliang

memset question: all result is 0?

Discussion created by haochunliang on Jul 21, 2011
Latest reply on Jul 21, 2011 by haochunliang

Hello!

 

I am trying the sample code 1 from the programming guide page 1-20, which is a memset program. However the kernel seems not working at all while there are no error and no warning. The buffer appears to be all 0 no matter how I change the kernel.

such as:

 

const char *source =

"_kernel void memset(_global uint* dst)                     \n"

"{                                                          \n"

" dst[get_global_id(0)] = 1;               \n"

"}                                                          \n";

or
const char *source =
"_kernel void memset(_global uint* dst)                     \n"
"{                                                          \n"
" dst[get_global_id(0)] = get_global_id(0);               \n"
"}                                                          \n";
It just doesn't matter what the kernel is, the number in buffer is always 0 in output.
I checked for several times the code of mine is exactly the same with code in the guide, and I am using VS2010 to compile.
What should I do about it? How do I get my kernel work?
Thank you~


Outcomes