Allocates at least
depth bytes of linear memory on the device and returns a cudaPitchedPtr in which
ptr is a pointer to the allocated memory. The function may pad the allocation to ensure hardware alignment requirements are met. The pitch returned in the
pitch field of
pitchedDevPtr is the width in bytes of the allocation.
The returned cudaPitchedPtr contains additional fields
ysize, the logical width and height of the allocation, which are equivalent to the
extent parameters provided by the programmer during allocation.
For allocations of 2D and 3D objects, it is highly recommended that programmers perform allocations using cudaMalloc3D() or cudaMallocPitch(). Due to alignment restrictions in the hardware, this is especially true if the application will be performing memory copies involving 2D or 3D objects (whether linear memory or CUDA arrays).
|pitchedDevPtr ||- Pointer to allocated pitched device memory |
|extent ||- Requested allocation size (|
width field in bytes)
- cudaSuccess, cudaErrorMemoryAllocation
- Note that this function may also return error codes from previous, asynchronous launches.
- See also:
- cudaMallocPitch, cudaFree, cudaMemcpy3D, cudaMemset3D, cudaMalloc3DArray, cudaMallocArray, cudaFreeArray, cudaMallocHost (C API), cudaFreeHost, cudaHostAlloc, make_cudaPitchedPtr, make_cudaExtent