Main Content

mxGPUCopyFromMxArray (C)

Copy mxArray to mxGPUArray

C Syntax

#include "gpu/mxGPUArray.h"
mxGPUArray* mxGPUCopyFromMxArray(mxArray const * const mp)

Arguments

mp

Pointer to an mxArray that contains either GPU or CPU data.

Returns

Pointer to an mxGPUArray.

Description

mxGPUCopyFromMxArray produces a new mxGPUArray object with the same characteristics as the input mxArray.

  • If the input mxArray contains a gpuArray, the output is a new copy of the data on the GPU.

  • If the input mxArray contains numeric or logical CPU data, the output is copied to the GPU.

Either way, this function always allocates memory on the GPU and allocates a new mxGPUArray object on the CPU. Use mxGPUDestroyGPUArray to delete the result when you are done with it.

Version History

Introduced in R2013a