help with work-group

hi, I’m working on a neural networking program using OpenCl.
I’m really new to OpenCl and couldn’t understand its concepts and usage of work-groups.
this is some sample code :


__kernel void calcu_h(__global float* sum_h, __global float* w_hi, __global int* unit_i, __global float* unit_h)
{
   int i,h,p;

    for(p=0; p<26;p++){
    	for(h=0;h<100;h++){
    		for(sum_h[(p*100)+h]=0.0,i=0;i<=100;i++)
    			sum_h[(p*100)+h]+=w_hi[(h*100)+i]* (float)unit_i[(p*100)+i];
    		unit_h[(p*100)+h] = 1.0/(1.0+(float)exp(-(float)(sum_h[(p*100)+h])));
    	}
         unit_h[(p*100)+h]=1.0;	
   }
}

as you can see that I’m using too many loops.
Can anybody tell me how to fix these loops to work-groups or work-item ?

Data parallelism, SPMD - you definitelly should google for those.

Just quick hint:

1.Sequential code:


float * in = new float(100);
float * out = new float(100);

for(int i=0; i<100; ++i)
{
    out[i] = doSomething(in[i]);
}

2.Parallel code:

_kernel (__global float* g_in, __global float* g_out)
{
    int i = get_local_id(0);
    g_out[i] = doSomethin(g_in[i]);
}
// assuming single 1D work-group of 100 work-items