Possible duplicate:
Counting the number of numbers in a cuda array
Is there a way to use thrust or cuda to count errors for duplicates in an array?
for example, if I have a device vector {11, 11, 9, 1, 3, 11, 1, 2, 9, 1, 11} I should get 1: 3 2: 1 3: 1 9: 2, 11: 4
if emphasis cannot do this, how can I use this core?
Thanks! I am doing a concentration calculation. that is why i ask this question. suppose in a domain of 100,000 particles that have nx X ny X nz cells, I need to calculate the concentration of each cell (how many particles in each cell)
My core is
__global__ void concentration_kernel(float3* posPtr, uint* device_cons) { __shared__ uint cache[256]; uint x = threadIdx.x + blockIdx.x * blockDim.x; uint y = threadIdx.y + blockIdx.y * blockDim.y; uint offset = x + y * blockDim.x * gridDim.x; float3 posf3 = posPtr[offset];
user1536720
source share