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 ?