GPU CUDA and MEX Programming
Further accelerate your code using advanced 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
All MEX files, including those containing CUDA code, have a single entry point known as
mexFunction
.
Featured Examples
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 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)