Computing TCPA Weird results when computing larger amounts of data.

Hi!

I am new to CUDA and have a problem I hope someone can help me solve.

I have created a small program for computing the time when two objects will be closest to each other. I make this computation for all pairs in a set of objects and save the result for each object. The result for object 1 is for example that object X will be object 1 closest neighbour at a distance Y at time Z.

My problem is that when I run the program with 100 objects I get ok results on some of the calculations and very werid results on some. My question is: why is this happening and what can I do to solve this problem?

The code was written in Visual Studion 2005.

Graphics card: GeForce 8800 GT.

The code can be found here:
http://pastebin.com/d24a3630d

Wictor.
main.zip (1.85 MB)