Reputation: 132
Edit: Compiling for AMD GPU and for Intel CPU gives the same error. It is all the code, I just deleted a few blank lines for posting it here.
My kernel
__kernel void distances(constant float* data, int n, int D, int k, global float* centroids, global int* cluster, global float* distances) {
local float l_distances[64];
private int idg = get_global_id(0);
private int idl = get_local_id(0);
private double sqdist = 0;
for(int i=0; i<k;i++){
sqdist=0;
for (int j=0; j<D;j++){
sqdist = fma((double)(centroids[i*D]-data[D*idg+j]), (double)(centroids[i*D]-data[D*idg+j]),sqdist);
}
l_distances[k*idl+i] = sqrt(sqdist);
}
private float d_min=0;
for(int i=0;i<k;i++){
d_min = (d_min<l_distances[k*idl+i]) ? l_distances[k*idl+i] : d_min;
cluster[idg] = (d_min==l_distances[k*idl+i]) ? i : cluster[idg];
}
distances[idg] = l_distances[idl];
}
gives the following errors:
...Temp\OCL1304T1.cl", line 35: error: expected a
declaration
]=l_distances[idl];
^
...Temp\OCL1304T1.cl", line 41: error: expected a
declaration
}
^
why?
Upvotes: 0
Views: 169
Reputation: 6333
In this line: distances[idg] = l_distances[idl];
you are assigning to distances
which is both a variable and the name the of your function. I recommend changing one of them.
Upvotes: 1