- Configure the model to operate in "Normal" mode rather than "Accelerated" mode.
- Avoid setting the "UseParallel" flag to true within the optimizer's settings.
Why do I receive an error "Problem creating Accelerator MEX file for model 'X'." when I try to run accelerator mode for a model containing s-function (Simulink 2019b)?
18 views (last 30 days)
Show older comments
I have a model which includes some S-function blocks that requires certain libraries. This libraries are included in the "Code Generation > Custom Code" section and also in Simulation Target section.
When I try to run a simulation in Accelerator mode I obtain the following error:
-### Build procedure for model: 'SimApplSw' aborted due to an error.
Problem creating Accelerator MEX file for model 'SimApplSw'.
Caused by:
C:\Users\roccag\Desktop\AggregationModel_3_0\slprj\accel\SimApplSw\mathlib.c not found; check that you are in the correct current folder, and check the spelling of 'C:\Users\roccag\Desktop\AggregationModel_3_0\slprj\accel\SimApplSw\mathlib.c'.
Normal simulation runs correctly.
Thanks,
Giuseppe
0 Comments
Answers (1)
Shivani
on 4 Mar 2024
I understand that you’re currently facing an error while running a simulation in accelerator mode
The error you're experiencing is due to an attempt to optimize an accelerated Simulink model while the "UseParallel" flag is enabled in the optimization function. Since the model needs to be compiled for acceleration, any changes to the model will require the compiled code to be deleted and recompiled before the next simulation. When operating in parallel, multiple workers may try to delete and compile the same files at the same time, which can lead to the "Invalid argument" error you're seeing.
The following workarounds can get around this issue:
Additionally, you can refer to this MATLAB Answer thread for more details: Problem creating Accelerator MEX file for simulink model in windows 10 - MATLAB Answers - MATLAB Central (mathworks.com)
Hope this helps!
0 Comments
See Also
Categories
Find more on Block and Blockset Authoring in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!