This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mxGPUCreateGPUArray (C)

Create mxGPUArray object, allocating memory on GPU

C Syntax

#include "gpu/mxGPUArray.h"
mxGPUArray* mxGPUCreateGPUArray(mwSize const ndims,
                                mwSize const * const dims,
                                mxClassID const cid,
                                mxComplexity const ccx,
                                mxGPUInitialize const init0)



mwSize type specifying the number of dimensions in the created mxGPUArray.


Pointer to an mwSize vector specifying the sizes of each dimension in the created mxGPUArray.


mxClassID type specifying the element class of the created mxGPUArray.


mxComplexity type specifying the complexity of the created mxGPUArray.


mxGPUInitialize type specifying whether to initialize elements values to 0 in the created mxGPUArray.

  • A value of MX_GPU_INITIALIZE_VALUES specifies that elements are to be initialized to 0.

  • A value of MX_GPU_DO_NOT_INITIALIZE specifies that elements are not to be initialized.


Pointer to an mxGPUArray.


mxGPUCreateGPUArray creates a new mxGPUArray object with the specified size, type, and complexity. It also allocates the required memory on the GPU, and initializes the memory if requested.

This function allocates a new mxGPUArray object on the CPU. Use mxGPUDestroyGPUArray to delete the object when you are done with it.

Introduced in R2013a