Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Profiling using OpenModelica with CPP runtime

Profiling using OpenModelica with CPP runtime

Hello,
I have built OpenModelica 1.18 from source with CPP runtime on a Raspberry PI device. I used the omc with options --simCodeTarget=Cpp and --profiling=all_stat when compiling my simulation model. I was also able to use the <modelName>.makefile to compile the CPP files to generate a binary. Please suggest how I can check the profiling information once my binary is executed.

Thank you.

Re: Profiling using OpenModelica with CPP runtime

After you run the executable an html report should be generated, at least this is what happens using the C runtime. I will check now with Cpp runtime and let you know.

Re: Profiling using OpenModelica with CPP runtime

The Cpp runtime generates just a json file it seems with the profiling.

You could use the C runtime

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# cat t.mos
setCommandLineOptions("--profiling=blocks+html"); getErrorString();
loadModel(Modelica, {"3.2.3"}); getErrorString();
buildModel(Modelica.Blocks.Examples.PID_Controller); getErrorString();

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# ../omc t.mos
true
""
true
{"C:/home/adrpo33/dev/OpenModelica/build/bin/temp/Modelica.Blocks.Examples.PID_Controller","Modelica.Blocks.Examples.PID_Controller_init.xml"}
""

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# ./Modelica.Blocks.Examples.PID_Controller.exe
LOG_SUCCESS       | info    | The initialization finished successfully with 3 homotopy steps.
LOG_SUCCESS       | info    | The simulation finished successfully.
stdout            | info    | Time measurements are stored in Modelica.Blocks.Examples.PID_Controller_prof.html (human-readable) and Modelica.Blocks.Examples.PID_Controller_prof.xml (for XSL transforms or more details)

Then open Modelica.Blocks.Examples.PID_Controller_prof.html in the browser.

Edited by: adrpo - Mar-04-21 20:41:49

Re: Profiling using OpenModelica with CPP runtime

Thank you for your reponse. For the C runtime, I followed the steps you suggested, which was to set --profiling=blocks+html and then build and run the executable to generate the HTML file. I could see that the HTML file had the profiling data for the simulation. I now have a few follow-up questions.
1. Instead of blocks+html, I tried to use --profiling=all_stat for the C runtime when generating the C code and the makefile. After a successful build, when I ran the simulation, two files were generated with the name being <ModelName>_prof.intidata and <ModelName>_prof.realdata. Please note that No html/JSON files were generated this time. Kindly help me understand how I can read the profiling data in this case.

2. For the CPP runtime, I also tried to set --profiling=blocks+html, and then built the executable. However, when I tried to run the executable with the additional set of parameters, I got the error  "Simulation stopped with error in utility: No time measurement for this processor arch". I changed the --profiling=all_stat and yet I ended up with the same runtime error. Hence, it will be really helpful, if you may suggest what I need to do to enable profiling for the CPP runtime.

Please let me know if you need any more information from me to respond to my queries. Thank you.

adrpo wrote:


The Cpp runtime generates just a json file it seems with the profiling.

You could use the C runtime

Code:


adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# cat t.mos
setCommandLineOptions("--profiling=blocks+html"); getErrorString();
loadModel(Modelica, {"3.2.3"}); getErrorString();
buildModel(Modelica.Blocks.Examples.PID_Controller); getErrorString();

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# ../omc t.mos
true
""
true
{"C:/home/adrpo33/dev/OpenModelica/build/bin/temp/Modelica.Blocks.Examples.PID_Controller","Modelica.Blocks.Examples.PID_Controller_init.xml"}
""

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OpenModelica/build/bin/temp
# ./Modelica.Blocks.Examples.PID_Controller.exe
LOG_SUCCESS       | info    | The initialization finished successfully with 3 homotopy steps.
LOG_SUCCESS       | info    | The simulation finished successfully.
stdout            | info    | Time measurements are stored in Modelica.Blocks.Examples.PID_Controller_prof.html (human-readable) and Modelica.Blocks.Examples.PID_Controller_prof.xml (for XSL transforms or more details)

Then open Modelica.Blocks.Examples.PID_Controller_prof.html in the browser.

There are 0 guests and 0 other users also viewing this topic
You are here: