User`s guide

xiii
Example: Run Your MATLAB Code . . . . . . . . . . . . . . . . . . 9-14
Supported MATLAB Code . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15
Identify and Select a GPU Device . . . . . . . . . . . . . . . . . . . . . 9-18
Example: Select a GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-18
Run CUDA or PTX Code on GPU . . . . . . . . . . . . . . . . . . . . . . 9-20
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20
Create a CUDAKernel Object . . . . . . . . . . . . . . . . . . . . . . . 9-21
Run a CUDAKernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-26
Complete Kernel Workflow . . . . . . . . . . . . . . . . . . . . . . . . . 9-28
Run MEX-Functions Containing CUDA Code . . . . . . . . . . . . 9-31
Write a MEX-File Containing CUDA Code . . . . . . . . . . . . . 9-31
Set Up for MEX-File Compilation . . . . . . . . . . . . . . . . . . . . 9-32
Compile a GPU MEX-File . . . . . . . . . . . . . . . . . . . . . . . . . . 9-33
Run the Resulting MEX-Functions . . . . . . . . . . . . . . . . . . . 9-33
Comparison to a CUDA Kernel . . . . . . . . . . . . . . . . . . . . . . 9-33
Access Complex Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-34
Measure and Improve GPU Performance . . . . . . . . . . . . . . . 9-35
Basic Workflow for Improving Performance . . . . . . . . . . . . . 9-35
Advanced Tools for Improving Performance . . . . . . . . . . . . 9-36
Best Practices for Improving Performance . . . . . . . . . . . . . . 9-37
Measure Performance on the GPU . . . . . . . . . . . . . . . . . . . 9-38
Vectorize for Improved GPU Performance . . . . . . . . . . . . . . 9-39