加速
在 MATLAB® 和 Simulink® 中加速代码处理
为了在原型构建时加速您的代码执行,您可以:
通过使用
parfor函数利用多个核或工作单元。在 GPU 上运行您的代码。通常,您可以使用
gpuArray(Parallel Computing Toolbox) 函数将数据传输到 GPU,然后使用gather(Parallel Computing Toolbox) 函数从 GPU 检索输出数据。有关 Communications Toolbox™ 功能的列表,请参阅支持 GPU 数组的函数和 System object。在云中或具有多个工作单元的集群上运行您的仿真。有关详细信息,请参阅MathWorks Cloud Center (Parallel Computing Toolbox)。
函数
backgroundPool | 在后台运行代码的环境 (自 R2021b 起) |
gather | 将分布式数组、Composite 对象或 gpuArray 对象传输到本地工作区 |
gpuArray | 存储在 GPU 上的数组 |
parfor | 并行 for 循环 |
主题
- Background Data Generation
Generate simulation input data in the background while running your simulation loop on parameterized conditions rather than generating the data in advance and recalling the stored data and run time. (自 R2026a 起)
- Simulation Acceleration Using Parallel Computing Toolbox
Ways to accelerate the simulation of communications algorithms in MATLAB.
- Accelerate Simulation Using GPUs
Speed up your communications system simulation using GPUs.





