Hi, i don't know what i'm doing wrong, I want calc the sum of many values on array, but when i try put in a for loop with "sum = sum + 4;" for example, this lock my computer and i need reboot system.

this is my code now:

const char *KernelSource = "\n" \
"__kernel void calcpi( \n" \
" __global float* input, \n" \
" __global float* output, \n" \
" const unsigned int count) \n" \
"{ \n" \
" int i = get_global_id(0); \n" \
" int n=100; int k = i*n; \n" \
" __private float sum = 0; \n" \
" float z = 0; \n" \
" output[i] = 0; \n" \
" for (k=i*n;k<i+n;k++) { \n" \
" z = (float)k*2+1; \n" \
" sum = sum + 4.0 / z; \n" \
" } \n" \
" if(i < count) \n" \
" output[i] = sum; \n" \
"} \n" \
"\n";

what i'm doing wrong? anyone can help me?
Thank you