lihaolin88 / 3D-Half-Gaussian-Splatting

48 stars 4 forks source link

Debug cuda code #3

Closed gwen233666 closed 21 hours ago

gwen233666 commented 3 days ago

Hello, how do you debug cuda code when you add normal parameters? I also want to add some new attributes to gaussians, but I don't know how to add them, which makes me very upset. Can you give me some suggestions? Appreciate very much~

lihaolin88 commented 2 days ago

Hello, this is a good question. Debugging code during training or testing can be challenging. There are two approaches you can consider:

  1. Save the result from the Python code and use it as input for CUDA code, you can then use cuda-gdb to debug the code. This allows you to only run the CUDA part and set breakpoints.

  2. Use "printf" in the CUDA code. This method involves printing out the data you want to check. While simple and effective for inspecting the entire pipeline, it requires careful design of the architecture and considerate tracking of changes and expected outputs.

To add new attributes, I recommend looking through ./scene/gaussian_model.py and especially paying attention to the "init" functions. Then, you will have some ideas on how to add new attributes to Gaussians.