Notes on using texture memory in Cuda

Source: Internet
Author: User

Recently, I am working on a Cuda project, where the texture memory is used to accelerate the Data Reading and interpolation processes. because some details are not fully noticed. the progress of this project is slow. data accuracy is very high. there is no way. We can only conduct step-by-step troubleshooting and solve this problem completely today. the reason is that the texture index is not noticed. OK. If you want to talk less, pay attention directly.

 

Texture access in Cuda can be divided into the nearest point interpolation cudafiltermodepoint and the linear interpolation cudafiltermodelinear. the problem with this project lies in linear interpolation. in some general computing, we use 3dtexture not because all the data is correlated. Maybe the data only has 2D relevance, but they are bound together for processing convenience. then, the values of 2D data are read cyclically. however, before performing linear interpolation, Cuda will first subtract the index value by 0.5. Therefore, directly using the index during the loop or other integer indexes will cause a calculation error and cannot obtain the expected value. now that you know the reason, everything is easy to do. You can directly index + 0.5 and then process it, and then OK.


It's that simple to say, but if you don't notice it, you will have to be depressed every day. Recently, you are always making some strange and strange little problems.ProgramDo not pay attention. if the problem is not displayed after testing, the problem is displayed. it seems that no matter how simple the project is to be done, or you know more about its implementation, or this is justAlgorithmImplementation rather than engineering projects (what I do now) should develop good development habits and conduct detailed unit tests on the intermediate steps. otherwise, the development will take longer and there will be more problems. it seems that you need to complete the software engineering knowledge.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.