Accelerating Simulink/Matlab projects with SYCL

Uwe Dolinsky
{"title":"Accelerating Simulink/Matlab projects with SYCL","authors":"Uwe Dolinsky","doi":"10.1145/3585341.3585363","DOIUrl":null,"url":null,"abstract":"Matlab/Simulink is a very popular software development tool which is widely used in academia and industry to build and evaluate complex dynamical systems. It combines graphical modelling with the ability to develop algorithms directly in the Matlab language and offers various toolboxes targeting a wide range of applications in automotive, robotics, image processing, machine learning and other areas. For deployment on various platforms the Matlab/Simulink projects are typically translated into C/C++ by MathWorks’ Simulink/Matlab Coder tool and subsequently built by the C/C++ toolchain for the targeted platform. In this talk we present a new tool flow to accelerate Simulink/Matlab projects with SYCL. This enables Matlab/Simulink projects to take advantage of the growing open-source SYCL ecosystem to accelerate complex Simulink models on a wide range of diverse platforms in a standards-based way. This enables Matlab/Simulink projects to directly benefit from performance-optimized SYCL algorithms and tools to tune the performance of Simulink models on different hardware. The presented tool flow does not require Matlab/Simulink to be installed and no Matlab/Simulink dependencies are required. The approach is non-disruptive in that the Simulink/Matlab developers do not need to know SYCL and do not need to adapt Simulink/Matlab solutions to take advantage of SYCL. In this work Simulink/Matlab solutions are translated with the help of open-source tools into C++ code calling an API which can be customized to use different algorithms and libraries as backends. For example, vector/matrix operations are typically performed in this flow by the Eigen library while scalar operations are performed by the standard C++ library. API functions for specific Matlab/Simulink operations or operands can be implemented or overloaded/specialized to use different libraries if needed. For example operations on large matrices or vectors can be implemented using SYCL-BLAS to take advantage of highly parallel linear algebra operations that can be autotuned to maximize performance for a given platform. The presented tool flow converts entire Simulink solutions into C++ code. It does so by reading in Simulink solutions files (in.slx or.mdl format) and extracting the models and their associated sub models and blocks. It also reads in and integrates data files (*.mat files), data dictionary files, and Matlab files to initialize the workspace. The blocks are then scheduled and translated into C++ code constituting the model step which is run to execute the model. Models can contain sub models, model references and sub systems – which can contain embedded Matlab files that are executed when the associated blocks are executed. These Matlab files are converted into C++ code and integrated with the code generated from the containing Simulink block. The tool flow solved various challenges when converting Matlab code into C++, and supports most Matlab language features. The presented tool flow has already been applied to accelerate complex Matlab/Simulink models in automotive projects: developed as part of a collaboration project with Williams Advanced Engineering the tool flow was used to accelerate large Simulink models of novel hybrid battery types for Electric Vehicles via SYCL. These models run on an embedded platform directly on the battery and acceleration enables more complex and accurate models to be run. This presentation shows the tool flow applied to opensource Simulink/Matlab code. We will present the results at SYCLcon. Performance varies by use, configuration and other factors. Your costs and results may vary.","PeriodicalId":360830,"journal":{"name":"Proceedings of the 2023 International Workshop on OpenCL","volume":"118 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2023-04-18","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2023 International Workshop on OpenCL","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3585341.3585363","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Matlab/Simulink is a very popular software development tool which is widely used in academia and industry to build and evaluate complex dynamical systems. It combines graphical modelling with the ability to develop algorithms directly in the Matlab language and offers various toolboxes targeting a wide range of applications in automotive, robotics, image processing, machine learning and other areas. For deployment on various platforms the Matlab/Simulink projects are typically translated into C/C++ by MathWorks’ Simulink/Matlab Coder tool and subsequently built by the C/C++ toolchain for the targeted platform. In this talk we present a new tool flow to accelerate Simulink/Matlab projects with SYCL. This enables Matlab/Simulink projects to take advantage of the growing open-source SYCL ecosystem to accelerate complex Simulink models on a wide range of diverse platforms in a standards-based way. This enables Matlab/Simulink projects to directly benefit from performance-optimized SYCL algorithms and tools to tune the performance of Simulink models on different hardware. The presented tool flow does not require Matlab/Simulink to be installed and no Matlab/Simulink dependencies are required. The approach is non-disruptive in that the Simulink/Matlab developers do not need to know SYCL and do not need to adapt Simulink/Matlab solutions to take advantage of SYCL. In this work Simulink/Matlab solutions are translated with the help of open-source tools into C++ code calling an API which can be customized to use different algorithms and libraries as backends. For example, vector/matrix operations are typically performed in this flow by the Eigen library while scalar operations are performed by the standard C++ library. API functions for specific Matlab/Simulink operations or operands can be implemented or overloaded/specialized to use different libraries if needed. For example operations on large matrices or vectors can be implemented using SYCL-BLAS to take advantage of highly parallel linear algebra operations that can be autotuned to maximize performance for a given platform. The presented tool flow converts entire Simulink solutions into C++ code. It does so by reading in Simulink solutions files (in.slx or.mdl format) and extracting the models and their associated sub models and blocks. It also reads in and integrates data files (*.mat files), data dictionary files, and Matlab files to initialize the workspace. The blocks are then scheduled and translated into C++ code constituting the model step which is run to execute the model. Models can contain sub models, model references and sub systems – which can contain embedded Matlab files that are executed when the associated blocks are executed. These Matlab files are converted into C++ code and integrated with the code generated from the containing Simulink block. The tool flow solved various challenges when converting Matlab code into C++, and supports most Matlab language features. The presented tool flow has already been applied to accelerate complex Matlab/Simulink models in automotive projects: developed as part of a collaboration project with Williams Advanced Engineering the tool flow was used to accelerate large Simulink models of novel hybrid battery types for Electric Vehicles via SYCL. These models run on an embedded platform directly on the battery and acceleration enables more complex and accurate models to be run. This presentation shows the tool flow applied to opensource Simulink/Matlab code. We will present the results at SYCLcon. Performance varies by use, configuration and other factors. Your costs and results may vary.
使用SYCL加速Simulink/Matlab项目
Matlab/Simulink是一种非常流行的软件开发工具,广泛用于学术界和工业界构建和评估复杂的动态系统。它将图形建模与直接使用Matlab语言开发算法的能力相结合,并提供针对汽车,机器人,图像处理,机器学习和其他领域广泛应用的各种工具箱。为了在各种平台上部署,Matlab/Simulink项目通常由MathWorks的Simulink/Matlab编码器工具翻译成C/ c++,随后由C/ c++工具链为目标平台构建。在这次演讲中,我们介绍了一个新的工具流来加速SYCL的Simulink/Matlab项目。这使得Matlab/Simulink项目能够利用不断增长的开源SYCL生态系统,以基于标准的方式在广泛的不同平台上加速复杂的Simulink模型。这使得Matlab/Simulink项目可以直接受益于性能优化的SYCL算法和工具,以调整Simulink模型在不同硬件上的性能。给出的工具流程不需要安装Matlab/Simulink,也不需要Matlab/Simulink依赖项。该方法是非破坏性的,因为Simulink/Matlab开发人员不需要了解SYCL,也不需要调整Simulink/Matlab解决方案来利用SYCL。在这项工作中,在开源工具的帮助下,Simulink/Matlab解决方案被翻译成调用API的c++代码,该API可以自定义使用不同的算法和库作为后端。例如,在这个流程中,向量/矩阵操作通常由Eigen库执行,而标量操作由标准c++库执行。如果需要,可以实现或重载/专门化用于特定Matlab/Simulink操作或操作数的API函数,以使用不同的库。例如,可以使用SYCL-BLAS实现对大型矩阵或向量的操作,以利用高度并行的线性代数操作,这些操作可以自动调整以最大化给定平台的性能。给出的工具流程将整个Simulink解决方案转换为c++代码。它通过读取Simulink解决方案文件(在。基金或。MDL格式),并提取模型及其关联的子模型和块。它还读入和集成数据文件(*)。mat文件)、数据字典文件和Matlab文件来初始化工作空间。然后,这些块被调度并转换成c++代码,这些代码构成了执行模型的模型步骤。模型可以包含子模型、模型引用和子系统——它们可以包含嵌入的Matlab文件,这些文件在相关块执行时执行。这些Matlab文件被转换成c++代码,并与包含Simulink块生成的代码集成在一起。该工具流解决了将Matlab代码转换为c++时的各种挑战,并支持大多数Matlab语言特性。所提出的工具流程已经被应用于加速汽车项目中复杂的Matlab/Simulink模型:作为与Williams Advanced Engineering合作项目的一部分,该工具流程被用于通过SYCL加速电动汽车新型混合动力电池类型的大型Simulink模型。这些模型直接在电池上的嵌入式平台上运行,加速可以运行更复杂和准确的模型。本演示展示了应用于开源Simulink/Matlab代码的工具流程。我们将在SYCLcon上展示结果。性能因使用、配置和其他因素而异。您的成本和结果可能会有所不同。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信