Writing in to cudaArray

Hi all,

Can I access cudaAarray directly without the binding with texture? If not in that case, is cudaArray readonly? I havent seen any examples…

regards

In a word, no. cudaArrays are an opaque type (or maybe types) which cannot be directly read or written to without using the texture API functions.

:rolleyes: thx!

If I want to define my data in a 3D structure, using cudaMalloc3D is the only choice. Is it right?

Here is a citation: “CUDA Arrays” are stored in texture memory and accessed only from texture lookups on device side
So the answer to your question is: you are right

Here is another citation (CUDA Best Programming Practices):

“Within a kernel call, the texture cache is not kept coherent with respect to global memory writes, so texture fetches from addresses that have been written via global stores in the same kernel call return undefined data. That is, a thread can safely read a memory location via texture if the location has been updated by a previous kernel call or memory copy, but not if it has been previously updated by the same thread or another thread within the same kernel call. This is relevant only when fetching from linear or pitch-linear memory because a kernel cannot write to CUDA arrays.”

Thus 3D seems to be an exception since a 1D or 2D texture can be bound to “linear or pitch-linear memory” !? Too bad…

Here is another citation (CUDA Best Programming Practices):

“Within a kernel call, the texture cache is not kept coherent with respect to global memory writes, so texture fetches from addresses that have been written via global stores in the same kernel call return undefined data. That is, a thread can safely read a memory location via texture if the location has been updated by a previous kernel call or memory copy, but not if it has been previously updated by the same thread or another thread within the same kernel call. This is relevant only when fetching from linear or pitch-linear memory because a kernel cannot write to CUDA arrays.”

Thus 3D seems to be an exception since a 1D or 2D texture can be bound to “linear or pitch-linear memory” !? Too bad…

In Cuda 3.1, a “Surface” can be used to read/write a CudaArray. Not sure about 3D though.

In Cuda 3.1, a “Surface” can be used to read/write a CudaArray. Not sure about 3D though.