R2024b CodeGen crashes when compiling to C/C++, but .mex no errors. R2018a compiles with no problems.

10 ビュー (過去 30 日間)
Dr W Kurt
Dr W Kurt 2024 年 10 月 16 日
回答済み: Subhajyoti 2024 年 10 月 23 日 4:54
I recently upgraded to R2024b. This code compiles to .mex or C/C++ without issues using R2018a on a 32gB machine.
However, with R2024b, compiling to C/C++ runs out of memory on a 65gB machine then crashes.
I use the Matlab Coder App to compile to C++, and this code compiles to .mex successfullly using R2024b, but crashes on compile to C/C++
Here's the Test Bench:
%% Test Bench for OFDMRxR1.m
%
load OFDMRxSave % Loads v1, v2, v3, & P1 (structure)
Packet = OFDMRxR1(v1,v2,v3,P1);
BitRate = 1153.00 Packet = □□□□Kabcdefghijklmnopqrstuvwxyz01234567899876543210zyxwvutsrqponmlkjihgfedcbabAB□□□ Program Termination: Successful
CODEGEN requires a MATLAB Coder license. Code generation failed: To view the report, open('codegen/mex/OFDMRxR1/html/report.mldatx')
Error using codegen
  1 件のコメント
Dr W Kurt
Dr W Kurt 2024 年 10 月 16 日
I am unable to upload the 'project' file, .prj because this web app doesn't accept that file format. However, here are a few images of the setup, it's simple; autodefine inputs, compile to .mex successfully, then compile to C/C++ and it will run out of memory and then crash.

サインインしてコメントする。

回答 (1 件)

Subhajyoti
Subhajyoti 2024 年 10 月 23 日 4:54
It is my understanding that you are able to generate the MEX files for your code. But when you are trying to generate C/C++ files, it is throwing out of memory error.
This error is due to implicit expansion operation occurring during run-time.
Refer to following MathWorks Documentation link to know more about ‘Optimize Implicit Expansion in Generated Code’ in MATLAB:
While generating MEX file, the MATLAB Coder generates C or C++ files (as mentioned in code-generation parameter) and the MEX file acts like an API between MATLAB and the C/C++ file. You can also use these C/C++ files directly as a workaround for code-generation error. The C/C++ build files are generated in the following path:
./codegen/mex/OFDMRxR1/
Additionally, you can refer to the following resources to know more about Analysis and Generation of C/C++ Code from MATLAB Code Using "MATLAB Coder":

カテゴリ

Help Center および File ExchangeGet Started with MATLAB Coder についてさらに検索

タグ

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by