I am attempting to use CUDA to find the distance between objects with 3D coordinates. That said, I am only interested in 2 types of objects. The objects are represented as numbers in an array. For this question I am only interested in getting the positions of the first type of object (a user specified number) in the object array.
To that end I'm currently trying to pass this list and a results list to my device and have the device check if each location in the array is the specified number (representing the first object) - and if it is, place that array location in a results array to be returned to the host.
As an example input, suppose I have:
int objectArray[10] = { 1, 11, 7, 2, 7, 23, 6, 6, 9, 11 };
int results[10]={0,0,0,0,0,0,0,0,0,0};
and I'm trying to get the positions of all the instances of 7 (and preferably, a returned value stating how many instances of 7 were found)
ie. (with instances of 7 being present in position 2 and 4 of objectArray
)
results={2,4,0,0,0,0,0,0,0,0};
resultCount=2;
I'm fairly new to Cuda and if anyone knows how this is done, I'd appreciate the help.
See Question&Answers more detail:
os