-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about CUDABuffer_<T> #49
Comments
Yes, that is exactly how it works. |
To elaborate a bit, there are two classes |
Thank you very much for your answer! In I searched these two variables in whole project, and it only appears here. These two variables are not defined, how does c++ compiler recognize the two variables? |
|
Hi,
I am new to CUDA programming and learning this open-source project.
Recently I was reading the source code of this project. I have a question about it. I will appreciate it if you can read this issue and answer my question.
In libvis/cuda/, the basic data structures are defined in the files under this directory.
For
/applications/badslam/src/badslam/cuda_depth_processing.cu
, the functionComputeNormalsCUDA
has a argumentCUDABuffer_<T>* out_normals
. I can understand this step: the pointer ofout_normals
is passed into this function.When this function launches the kernel function
ComputeNormalsCUDAKernel()
, it pass*out_normals
as an object into the kernel function. However, the kernel function receives an object as input in its argument list, instead of a reference. My question is: how could the modifications on*out_normals
in the kernel function affect theout_normals
?In other words, in the kernel function, it computes the normals and modifies the corresponding element of
out_normals
by usingout_normals(y, x) = xxx
, but it is not the reference of the object. It is a copy of the object.Is it because when the object
out_normals
is passed into the kernel function, the copy of*out_normals
copied its data head address, instead of allocating new memory space in GPU? So that when the copy of*out_normals
use the operatorout_normals(y, x)
, it modified the corresponding data with respect to the original data head pointeraddress
?Thank you very much for your time to read this question!
The text was updated successfully, but these errors were encountered: