How can i re-mex 'Matlab coder' generated .c, .h and .o files using ' -largedimarrays' flag ?
3 次查看(过去 30 天)
显示 更早的评论
Hi, I have some perfectly working matlab codes that I use for some calculation of electrical properties. These codes takes too much time in matlab so I decided to create mex files using codegen, and succeeded. For a while, I am using mex files in my program and there is a great improvement in execution time. However, my electrical problems getting bigger while the time passes. So, recently I got an error saying that: Cannot grow a matrix with greater than intmax() elements. I learned that to overcome this problem '-largedimarrays' flag should be used for mexing. But, I do not know how to mex the files in the codegen file created by matlab. I made a few research and still couldn't find a way to mex these files. So I am asking for help in the following issues:
1- codegen command created lots of .c .h ... files in a folder named codegen for a one .m file. How can I re-mex these files using-largesimarrays?
2- can I make it directly from the .m file by some option or a codegen flag while running codegen?
3- are there any other methods rather than largedimarrays method to solve the problem I faced in the first hand? (cannot grow ...)
Thank you in advance
0 个评论
采纳的回答
Ryan Livingston
2014-12-10
编辑:Ryan Livingston
2014-12-10
Currently, the maximum array size supported by MATLAB Coder MEX files is intmax('int32') elements:
Unfortunately, the limitation is deeper than a simple lack of the -largedimarrays flag. Rather, it results because of how the code is generated.
We made a note of your request for larger array support.
One possible workaround is to split your arrays into smaller pieces and work on those and then combine the results at the end of your computation.
2 个评论
Ryan Livingston
2014-12-14
1. MEX can support 64-bit sizes/indices:
The code currently generated by MATLAB Coder can use 32-bit indices.
Modifying the generated MEX code by hand is not recommended as there are dependencies for the MEX code on a runtime library that may also have restrictions.
2. Unfortunately, yes. The current best option that I see is to partition the arrays after they exceed the documented maximum size.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!