摘要
MATLAB被广泛应用于算法设计及验证,但由于平台限制及性能因素影响,实际工作中通常使用C语言及高性能库来重写和优化代码。人工转换MATLAB到C工作繁琐,而大部分已有的自动转换方法又难以解决MATLAB的高性能矢量运算和库函数与C的对接问题。为此,设计了一个MATLAB到高性能C的自动转换系统,通过将MATLAB代码转换为中间表示,进一步转换为C代码。同时,将MATLAB的高性能矢量运算和库函数对接到高性能C函数库Math Kernel Library(MKL)上。在相同MATLAB代码上的实验结果表明,该系统转换生成的C代码性能与人工编写的C代码相当,优于已有的转换方法生成的C代码。
MATLAB is widely used in algorithm design and verification,but due to the limitation of platform and poor performance,C language and high-performance libraries are usually used to rewrite and optimize the code in practical work.Manual conversion from MATLAB to C is cumbersome,and most existing automatic conversion methods are not able to bridge the high-performance vector operations and library functions of MATLAB with C.Therefore,an automatic system converting MATLAB to high-performance C code is designed.By converting MATLAB code into intermediate representation,it is further converted into C code.At the same time,the high-performance vector operations and library functions of MATLAB are bridged with the functions of the high-performance C Math Kernel Library(MKL).The experimental results on the same MATLAB codes show that the performance of the C code converted by this system is equivalent to that of the manually written C code,and is better than that converted by the existing conversion methods.
作者
余泽霖
徐云
Yu Zelin;Xu Yun(School of Computer Science and Technology,University of Science and Technology of China,Hefei 230026,China;Key Laboratory of High Performance Computing of Anhui Province,Hefei 230026,China)
出处
《信息技术与网络安全》
2022年第6期36-42,56,共8页
Information Technology and Network Security
基金
国家自然科学基金项目(61672480)
教育部和外专局高等学校学科创新引智计划项目(B0703308)。