Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the 16dae.c source file into multiple files #4851

Closed
OpenModelica-TracImporter opened this issue Jun 27, 2020 · 15 comments · Fixed by #12030
Closed

Split the 16dae.c source file into multiple files #4851

OpenModelica-TracImporter opened this issue Jun 27, 2020 · 15 comments · Fixed by #12030
Assignees
Labels
COMP/OMC/Codegen Issue and pull request related to Code generation
Milestone

Comments

@OpenModelica-TracImporter
Copy link
Member

No description provided.

@casella
Copy link
Contributor

casella commented Jan 24, 2022

@casella
Copy link
Contributor

casella commented Jan 24, 2022

The file modelName_16dae.c should be split into modelName_16dae_part0.c,modelName_16dae_part1.c, etc. if the size goes above a certain threshold, same way as modelName_06inz.c, so that large models can benefit of multi-CPU machines to shorten the code generation time.

@casella casella added the COMP/OMC/Codegen Issue and pull request related to Code generation label Feb 22, 2024
adrpo added a commit to adrpo/OpenModelica that referenced this issue Feb 24, 2024
@adrpo adrpo mentioned this issue Feb 24, 2024
adrpo added a commit that referenced this issue Feb 24, 2024
* fix ticket #4851, split 16dae.c into parts

* add test for #4581 fix
@casella casella added this to the 1.23.0 milestone Feb 25, 2024
@casella
Copy link
Contributor

casella commented Feb 27, 2024

@ceraolo, this should speed up the compilation phase significantly when running the larger PowerGrids tests, e.g. the IEEE14Bus models. Even more if you try larger models still.

@ceraolo
Copy link

ceraolo commented Feb 27, 2024

I suppose it depends on how many cores you have on you CPU isn'it? Is the number of logical processes also meaningful?

Have you made a comparison with the IEEE14bus included in powerGrids?
In principle I can try the same in one of the next days, but I first I must understand what I should expect, depending on the number of cores and logical processors (I don' have a multi-CPU machine, if such a thing exists)

@adeas31
Copy link
Member

adeas31 commented Feb 27, 2024

OMEdit bydefault compiles the model code in parallel with option Number of Processors which is fetch using numProcessors API. This is using logical processors.

So instead of compiling one big file, we split it in multiple files so that it can be compiled in parallel.

@casella
Copy link
Contributor

casella commented Feb 27, 2024

@ceraolo you sure have a multi-core CPU, unless your PC is more than 15 years old 😃. If it's a laptop, I guess it could have 4 or 8.

@ceraolo
Copy link

ceraolo commented Feb 28, 2024

@casella, I was just curious about your mentioning of multi-CPU machines. Now I realise you meant multi-core, which is more reasonable to me.
@adeas31, I expected that SW considers logical cores, not physical, and the CPU firmware and/or OS takes care of distributing machine code to the different physical cores. But was not totally sure. Thanks for confirming this.

Now I'm able to make tests on my machines.

@ceraolo
Copy link

ceraolo commented Feb 28, 2024

Now I'm able to make tests on my machines.

well... when IEEE14Bus models are working again!
I've checked today with Powergrids 2.0.0-develop downloaded the 19-th of February, but unfortunately none of the transient examples seems to be working with OM 1.23.0-dev-344.

@casella
Copy link
Contributor

casella commented Feb 29, 2024

@casella, I was just curious about your mentioning of multi-CPU machines. Now I realise you meant multi-core

Yeah, sorry, I meant multi-core CPUs 😅

@adeas31, I expected that SW considers logical cores, not physical, and the CPU firmware and/or OS takes care of distributing machine code to the different physical cores. But was not totally sure. Thanks for confirming this.

This is how it works, you have N physical cores (real processors in silicon). They all fight for access to memory, and they are often waiting for chunks of memory content to be transferred from the RAM to the processor cache. So, they had this bright idea, we pretend every physical core is two logical cores, and while one is waiting, the other one runs. In theory this can improve the performance for memory-intensive applications. In practice, even though you see all those virtual cores working 100%, they may actually be waiting for data to be shuttled from RAM to cache. In many cases it's really the number of physical cores that matters for actual speed-up.

Now I'm able to make tests on my machines.

Good.

@casella
Copy link
Contributor

casella commented Feb 29, 2024

well... when IEEE14Bus models are working again! I've checked today with Powergrids 2.0.0-develop downloaded the 19-th of February, but unfortunately none of the transient examples seems to be working with OM 1.23.0-dev-344.

This is weird, the latest test report gives
immagine
Never mind verification results, those are still in the works. The IEEE14 bus tests simulate successfully.

@casella
Copy link
Contributor

casella commented Feb 29, 2024

IEEE14busStaticNetwork works fine also on my laptop.

@ceraolo
Copy link

ceraolo commented Feb 29, 2024

IEEE14busStaticNetwork works fine also on my laptop.

I did not check this, but the "true" transient examples, as I said. But maybe my failures are due to an issue of the develop and/or OM nightly I used.

Did you make any performance test to see whether fixing this ticket has produced improvements?

@casella
Copy link
Contributor

casella commented Feb 29, 2024

PowerGrids.Examples.IEEE14bus.IEEE14busGen2Disconnection also works fine.

I haven't checked the performance change, I'd need to uninstall and reinstall, too busy now...

@casella
Copy link
Contributor

casella commented Feb 29, 2024

oops, I am using a nightly build which is older than Adrian's commit 2ab9ff8. I need to update it and re-check

@casella
Copy link
Contributor

casella commented Mar 2, 2024

See #12055

adrpo added a commit to adrpo/OpenModelica that referenced this issue Mar 3, 2024
- forward the equation functions in the main file 16dae.c file from the part files.
adrpo added a commit that referenced this issue Mar 3, 2024
- forward the equation functions in the main file 16dae.c file from the part files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/OMC/Codegen Issue and pull request related to Code generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants