I’ve implemented a RayTracer using CUDA before http://www.cs264.org/projects/web/Patel_Krunal/index.html
forget anything to do with STL and stuff (though I’ve been told using STL in device is bad)…
The main problem you have is sizeof(Object) < sizeof(Sphere)…I’m assuming that and am probably right…so when you declare a device pointer to Object and then say that you will be storing Spheres, I think you are messing things up. If you refer to my code above you’ll figure things out…sorry can’t be more helpful than that…it’s been a while since I’ve touched CUDA…only getting back on it now since I’m implementing Text Mining on GPU
I’ve implemented a RayTracer using CUDA before http://www.cs264.org/projects/web/Patel_Krunal/index.html
forget anything to do with STL and stuff (though I’ve been told using STL in device is bad)…
The main problem you have is sizeof(Object) < sizeof(Sphere)…I’m assuming that and am probably right…so when you declare a device pointer to Object and then say that you will be storing Spheres, I think you are messing things up. If you refer to my code above you’ll figure things out…sorry can’t be more helpful than that…it’s been a while since I’ve touched CUDA…only getting back on it now since I’m implementing Text Mining on GPU
Thank you for yous reply. I’m working in a raytracing algorithm as well.
I think I didn’t explain clearly what is my problem with the spheres. I’m not using vector inside my kernel. I read the input and save the spheres in a vector. Then I alocate a sphere array in device memory to use in my kernel. But I also have another objects (triangles, boxes, etc) just like you have. But I couldn’t alocate a “Object **objects”. How can I alocate an sphere in device and keep its address in my Object array?
Thank you for yous reply. I’m working in a raytracing algorithm as well.
I think I didn’t explain clearly what is my problem with the spheres. I’m not using vector inside my kernel. I read the input and save the spheres in a vector. Then I alocate a sphere array in device memory to use in my kernel. But I also have another objects (triangles, boxes, etc) just like you have. But I couldn’t alocate a “Object **objects”. How can I alocate an sphere in device and keep its address in my Object array?