Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to allocate cuda texture memory????can anyone help me with an example
Posted

1 solution

You define it with the texture syntax:
texture<Type, Dim, ReadMode> Name

Where:
Type is the data type (float, int, ...)
Dim is the number of dimensions 1D, 2D, 3D, represented as just the number 1, 2 or 3
ReadMode is the access allowed. Either cudaReadModeNormalizedFloat (a float value in the range [0-1], where ints are converted) or cudaReadModeElementType (The actual value you store in the memory). Reffer to section 4.3.4 of the Cuda Programming Guide[^] for a further explanation.
Name is your variable name

So, say we want a 2D array of integers (to be stored as integers), we would have
C++
texture<int, 2, cudaReadModeElementType> MyIntGrid;
 
Share this answer
 
Comments
renj00790 22-Nov-11 22:59pm    
ok.thanks.we use tex2D() for fetching the memory right???.
renj00790 22-Nov-11 23:02pm    
Can u help me in matrix addition using 1D memory and usind 2D blocks.That should be in GPU.Matrix should be square as well as non-square matrix.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900