GPU CUDA and MEX Programming
Functions
Key Functions and Classes
mexcuda | Compile MEX functions or PTX files for GPU computation |
CUDAKernel | Kernel executable on GPU |
feval | Evaluate kernel on GPU |
setConstantMemory | Set some constant memory on GPU |
C Functions and Classes
mxGPUArray | Type for MATLAB gpuArray |
mxGPUCopyFromMxArray | Copy mxArray to mxGPUArray |
mxGPUCopyGPUArray | Duplicate (deep copy) mxGPUArray object |
mxGPUCopyImag | Copy imaginary part of mxGPUArray |
mxGPUCopyReal | Copy real part of mxGPUArray |
mxGPUCreateComplexGPUArray | Create complex GPU array from two real gpuArrays |
mxGPUCreateFromMxArray | Create read-only mxGPUArray object from input mxArray |
mxGPUCreateGPUArray | Create mxGPUArray object, allocating memory on GPU |
mxGPUCreateMxArrayOnCPU | Create mxArray for returning CPU data to MATLAB with data from GPU |
mxGPUCreateMxArrayOnGPU | Create mxArray for returning GPU data to MATLAB |
mxGPUDestroyGPUArray | Delete mxGPUArray object |
mxGPUGetClassID | mxClassID associated with data on GPU |
mxGPUGetComplexity | Complexity of data on GPU |
mxGPUGetData | Raw pointer to underlying data |
mxGPUGetDataReadOnly | Read-only raw pointer to underlying data |
mxGPUGetDimensions | mxGPUArray dimensions |
mxGPUGetNumberOfDimensions | Size of dimension array for mxGPUArray |
mxGPUGetNumberOfElements | Number of elements on GPU for array |
mxGPUIsSame | Determine if two mxGPUArrays refer to same GPU data |
mxGPUIsSparse | Determine if mxGPUArray contains sparse GPU data |
mxGPUIsValidGPUData | Determine if mxArray is pointer to valid GPU data |
mxGPUSetDimensions | Modify number of dimensions and size of each dimension |
mxIsGPUArray | Determine if mxArray contains GPU data |
mxInitGPU | Initialize MATLAB GPU library on currently selected device |
Topics
- Run CUDA or PTX Code on GPU
This page explains how to create an executable kernel from a CUDA® C++ source file (CU) file and run that kernel on a GPU in MATLAB®.
- Run MEX-Functions Containing CUDA Code
As with any MEX-files, those containing CUDA code have a single entry point, known as
mexFunction
.
Featured Examples
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)