Main Content

Code Generation and GPU Support

Generate portable C/C++/MEX functions and use GPUs to deploy or accelerate processing

Audio Toolbox™ includes support to accelerate prototyping in MATLAB® and to generate code for deployment.

GPU Code Acceleration.  To speed up your code while prototyping, Audio Toolbox includes functions that can execute on a Graphics Processing Unit (GPU). You can use the gpuArray (Parallel Computing Toolbox) function to transfer data to the GPU and then call the gather (Parallel Computing Toolbox) function to retrieve the output data from the GPU. For a list of Audio Toolbox functions that support execution on GPUs, see Function List (gpuArray support). You need Parallel Computing Toolbox™ to enable GPU support.

C/C++ Code Generation.  After you develop your application, you can generate portable C/C++ source code, standalone executables, or standalone applications from your MATLAB code. C/C++ code generation enables you to run your simulation on machines that do not have MATLAB installed and to speed up processing while you work in MATLAB. For a list of Audio Toolbox functions that support C/C++ code generation, see Function List (C/C++ Code Generation). You need MATLAB Coder™ to generate C/C++ code.

GPU Code Generation.  After you develop your application, you can generate optimized CUDA® code for NVIDIA® GPUs from MATLAB code. The code can be integrated into your project as source code, static libraries, or dynamic libraries, and can be used for prototyping on GPUs. You can also use the generated CUDA code within MATLAB to accelerate computationally intensive portions of your MATLAB code in machine learning, deep learning, or other applications. For a list of Audio Toolbox functions that support GPU code generation, see Function List (GPU Code Generation). You need MATLAB Coder and GPU Coder™ to generate CUDA code.

Apps

MATLAB CoderGenerate C code or MEX function from MATLAB code
GPU CoderGenerate GPU code from MATLAB code

Functions

codegenGenerate C/C++ code from MATLAB code
gatherTransfer distributed array or gpuArray to local workspace
gpuArrayArray stored on GPU

Topics

Generate C Code at the Command Line (MATLAB Coder)

Generate C/C++ code from MATLAB code by using the codegen command.

Run MATLAB Functions on a GPU (Parallel Computing Toolbox)

Hundreds of functions in MATLAB and other toolboxes run automatically on a GPU if you supply a gpuArray (Parallel Computing Toolbox) argument.

Prerequisites for Deep Learning with MATLAB Coder (MATLAB Coder)

Install products and configure environment for code generation for deep learning networks.

GPU Support by Release (Parallel Computing Toolbox)

Support for NVIDIA GPU architectures by MATLAB release.

Featured Examples