cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

haochunliang
Journeyman III

memset question: all result is 0?

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~


0 Likes
1 Reply
haochunliang
Journeyman III

I got it working, it seems there are two underline before keyword "global" and "kernel", silly me.

 

0 Likes