How can I get the checksum of a compiled model and compare to current state?

3 vues (au cours des 30 derniers jours)
Sanders
Sanders le 4 Fév 2025
Modifié(e) : Sanders le 4 Fév 2025
TLDR: I am looking for a way to tell if Simulink will recompile or not the next time I run in accelerator mode to decide if I should switch to normal or not for shorter runs.
I am trying to create some logic that will determine, based on the length of a simulation length+speed and historic compile times, whether it should run it in normal mode or compile and run in accelerator mode. I have been reading about simulink.blockdiagram.getchecksum and went through the example Determine Why Simulink Accelerator Is Regenerating Code, but that only works if you run the getChecksum before (and after) and store the before checksum to compare to the after.
What I am seeking is an ability to get the checksum of the already compiled model (e.g. the contents of splrj/ or .slxc; probably not going to dig into the %AppData% Temp folder unless it can easily be done programatically) and the equivalent checksum of the current state of the model. Then I can see if running in accelerator mode is going to require the long compile or be able to re-use the already compiled accelerator model (I guess I'd also need a way to know if the previous version was an accelerator compile) and, if it requires a recompile, then I can decide if the compile time is worth it. Clearly, Simulink is able to make the checksum comparison to determine whether to recompile or not, and so I'd like to be able to as well.
My simulation can be run for a couple seconds or several minutes such that there is a sharp crossover in total time for short runs using normal mode and longer runs using accelerator (with the compile overhead). I am assuming that the overhead of the checksum is relatively negligible.

Réponses (0)

Catégories

En savoir plus sur Manual Performance Optimization dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by