cudaError_t cudaMalloc3DArray ( struct cudaArray **  array,
const struct cudaChannelFormatDesc desc,
struct cudaExtent  extent,
unsigned int  flags = 0 
)

Allocates a CUDA array according to the cudaChannelFormatDesc structure desc and returns a handle to the new CUDA array in *array.

The cudaChannelFormatDesc is defined as:

    struct cudaChannelFormatDesc {
        int x, y, z, w;
        enum cudaChannelFormatKind f;
    };
where cudaChannelFormatKind is one of cudaChannelFormatKindSigned, cudaChannelFormatKindUnsigned, or cudaChannelFormatKindFloat.

cudaMalloc3DArray() can allocate the following:

  • A 1D array is allocated if the height and depth extent are both zero. For 1D arrays, valid extent ranges are {(1, maxTexture1D), 0, 0}.
  • A 2D array is allocated if only the depth extent is zero. For 2D arrays, valid extent ranges are {(1, maxTexture2D[0]), (1, maxTexture2D[1]), 0}.
  • A 3D array is allocated if all three extents are non-zero. For 3D arrays, valid extent ranges are {(1, maxTexture3D[0]), (1, maxTexture3D[1]), (1, maxTexture3D[2])}.
  • A 1D layered texture is allocated if only the height extent is zero and the cudaArrayLayered flag is set. The number of layers is determined by the depth extent. For 1D layered textures, valid extent ranges are {(1, maxTexture1DLayered[0]), 0, (1, maxTexture1DLayered[1])}.
  • A 2D layered texture is allocated if all three extents are non-zero and the cudaArrayLayered flag is set. The number of layers is determined by the depth extent. For 1D layered textures, valid extent ranges are {(1, maxTexture2DLayered[0]), (1, maxTexture2DLayered[1]), (1, maxTexture2DLayered[2])}.

Note:
Due to the differing extent limits, it may be advantageous to use a degenerate array (with unused dimensions set to one) of higher dimensionality. For instance, a degenerate 2D array allows for significantly more linear storage than a 1D array.
The flags parameter enables different options to be specified that affect the allocation, as follows.
  • cudaArrayDefault: This flag's value is defined to be 0 and provides default array allocation
  • cudaArrayLayered: Allocates a layered texture, with the depth extent indicating the number of layers

Parameters:
array - Pointer to allocated array in device memory
desc - Requested channel format
extent - Requested allocation size (width field in elements)
flags - Flags for extensions (must be 0 for now)
Returns:
cudaSuccess, cudaErrorMemoryAllocation
Note:
Note that this function may also return error codes from previous, asynchronous launches.
See also:
cudaMalloc3D, cudaMalloc, cudaMallocPitch, cudaFree, cudaFreeArray, cudaMallocHost (C API), cudaFreeHost, cudaHostAlloc, make_cudaExtent


Generated by Doxygen for NVIDIA CUDA Library  NVIDIA