How to use mappable memory with texture mem in CUDA 2.2Beta

Hi.
In Cuda 2.2 beta programming guide. It shows how to allocate a mappable memory(a global memory pointer).
When I have to use 2d texture memory, It requires a cuda array.
But in programming guide, it does not mentioned how to allocate a mappable array.
Is it also availble in CUDA 2.2 Beta. or not availibal?

Oh, but in CUDA 2.2 you can now use a 2D texture on simple global memory so you don’t need the array anymore! Unless you need filtering/wrapped coordinates or something.

Excuse me, do you mean to use mappable memory can be as faster as use texture memory?

But in the programming guide of CUDA 2.2beta, it still describe how to use texture.

Why?

What was said is that before 2.2beta. If you wanted to use a 2D texture you would have to bind your 2D texture to a CudaArray (with setup involved) this is also global memory though.

Now with 2.2beta, it is also possible to use CudaMallocPitch to allocate ‘normal’ global memory and bind the 2D texture to this global memory pointer.

So, if I want to use 2d texture memory. Then I can not have the benifit of ZeroCopyAccess?

or I can still allocate a mappable host memory(through cudaSetDeviceFlags( cudaDeviceMapHost ) and cudaMallocHost)

and get the device pointer from cudaHostGetDevicePointer(),

then bind it to 2D texture to have both fetch and zerocopyaccess benifit?

But I check the reference manual, 2d texture binding can only be called with cudaarray whose type is cudaArray* but can not be put with a normal device memory even 2d memory.

It still confused me.

Hi, its solved.

I can use cudaBindTextureToArray to bind 2d memory to 2d texture.

Hi, I’ve got CUDA 2.2Beta,

But after my test, to use the mapped host memory to do calculate is ok.

But, to bind the 2d memory to texture memory and then use the texture to do calculate is fail.

It shows Microsoft C++ at memory location 0x0012fe24 occure exception: cudaError_enum

What I mean is to bind the texture won’t result in any error.

But after the 2d memory is binded, to use the memory will result in error.(to use the texture or the original 2d memory is the same, result in error)