GithubHelp home page GithubHelp logo

Question about CUDABuffer_<T> about badslam HOT 4 OPEN

eth3d avatar eth3d commented on July 18, 2024
Question about CUDABuffer_

from badslam.

Comments (4)

puzzlepaint avatar puzzlepaint commented on July 18, 2024

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 operator out_normals(y, x), it modified the corresponding data with respect to the original data head pointer address?

Yes, that is exactly how it works.

from badslam.

puzzlepaint avatar puzzlepaint commented on July 18, 2024

To elaborate a bit, there are two classes CUDABuffer and CUDABuffer_ that behave quite differently. The former one, CUDABuffer, is a bit higher-level and 'owns' the GPU buffer that it allocates. It is meant to be used from CPU code. For historical reasons (working with old CUDA versions), I could not pass such higher-level objects to CUDA code, since there had been incompatibilities. So I needed a light-weight helper class to access the same functionality from CUDA code. This is what CUDABuffer_ does. It is a simple wrapper over a few attributes of the buffer, and it can be retrieved with CUDABuffer::ToCUDA(). Copying the CUDABuffer_ object merely creates a copy of the pointer to the buffer, not a copy of the buffer itself.

from badslam.

lanfeiying avatar lanfeiying commented on July 18, 2024

Thank you very much for your answer!
I have another question about applications/badslam/src/badslam/cuda_depth_processing.cu.
For the CUDA kernel function ComputeMinMaxDepthCUDAKernel(), it is a template function. The template arguments are block_width and block_height.

In ComputeMinMaxDepthCUDA(), this function lauch the above CUDA kernel function.
However, I see it passes the template argument block_width and block_height without pre-definition.

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?

from badslam.

puzzlepaint avatar puzzlepaint commented on July 18, 2024

block_width and block_height are defined by the macro CUDA_AUTO_TUNE_2D_TEMPLATED(), which calls CUDA_AUTO_TUNE_2D_BORDER_TEMPLATED(), in libvis/src/libvis/cuda/cuda_auto_tuner.h.

from badslam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.