GPU CUDA and MEX Programming
Functions
Key Functions
mexcuda |
Compile MEX-function for GPU computation |
Parallel.gpu.cudakernel |
Create GPU CUDA kernel object from PTX and CU code |
Feval |
Evaluate kernel on GPU |
setConstantMemory |
Set some constant memory on GPU |
C功能
mxGPUCopyFromMxArray |
Copy mxArray to mxGPUArray |
mxgpucopygpuarray |
Duplicate (deep copy) mxGPUArray object |
mxGPUCopyImag |
复制mxGPUArra的虚部y |
mxGPUCopyReal |
复制MXGPUARRARAY的真实部分 |
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 |
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 |
Classes
关键类
CUDAKernel |
Kernel executable on GPU |
C Classes
mxGPUArray |
类型MATLAB GPUARRAY |
Topics
This topic explains how to create an executable kernel from CU or PTX (parallel thread execution) files, and run that kernel on a GPU from MATLAB®.
Run MEX-Functions Containing CUDA Code
As with any MEX-files, those containing CUDA®code have a single entry point, known asmexFunction
.
Featured Examples
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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éricaLatina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- 丹麦(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- 法国(Français)
- 爱尔兰(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- 挪威(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)