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

Use clang instead of gcc and compile with parallel threads when generating FMUs #11808

Closed
casella opened this issue Jan 15, 2024 · 8 comments
Closed
Assignees
Labels
COMP/FMI Issue and pull request related to FMI export
Milestone

Comments

@casella
Copy link
Contributor

casella commented Jan 15, 2024

As discussed in #11759, when we generate FMUs under Windows (not sure about Linux) we still use gcc and compile the files one at a time, which makes the whole thing horribly slow.

We should use clang and parallel processes instead, as we do for regular simulations.

@casella
Copy link
Contributor Author

casella commented Jan 15, 2024

Preferably use the same settings that we have for regular simulations in OMEdit

@AnHeuermann
Copy link
Member

AnHeuermann commented Jan 15, 2024

For general changes that should be applied to all compilations with CMake add options to OMCompiler/SimulationRuntime/fmi/export/buildproject/CMakeLists.txt.in.

If you want to add something that should depend on some omc setting easiest way is to add it in CevalScriptBackend.mo, like it was done for CMAKE_BUILD_TYPE.

Change compiler: cmake -DCMAKE_CXX_COMPILER=/pathto/clang++ -DCMAKE_C_COMPILER=/pathto/clang [...]
Number of threads: cmake --build . --target -j<N>

@casella
Copy link
Contributor Author

casella commented Jan 16, 2024

Adding @deepak19015 to the loop

@casella casella modified the milestones: 1.23.0, 1.22.2 Jan 16, 2024
@casella
Copy link
Contributor Author

casella commented Jan 17, 2024

Adding @Michelecroce to the loop

adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifer in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit to adrpo/OpenModelica that referenced this issue Jan 29, 2024
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808
adrpo added a commit that referenced this issue Jan 31, 2024
* Various FMU fixes
- Use the last identifier in the model path for the FMU build #11554
- Build FMUs in parallel with the specified number of processors #11808
- Build FMUs with the specified CC and CXX #11808

* Variable name
@adrpo
Copy link
Member

adrpo commented Jan 31, 2024

I guess this is now fixed via #11904. Reopen if there are any issues.

@adrpo adrpo closed this as completed Jan 31, 2024
@casella
Copy link
Contributor Author

casella commented Feb 1, 2024

Thanks @adrpo, I'll test this ASAP. If it works fine, I would port it to maintenance/v1.22, so I'm reopen it as a reminder

@casella casella reopened this Feb 1, 2024
@casella
Copy link
Contributor Author

casella commented Feb 1, 2024

I just generated an FMU of Buildings.Examples.ChillerPlant.DataCenterContinuousTimeControl using the latest nightly build on my Windows PC, it took about one minute (which is reasonable) and I checked with the Process Monitor that the compilation process was indeed using clang in parallel. Success!

@adrpo please cherry-pick this to maintenance/v1.22 and close the ticket.

adrpo added a commit to adrpo/OpenModelica that referenced this issue Feb 1, 2024
* Various FMU fixes
- Use the last identifier in the model path for the FMU build OpenModelica#11554
- Build FMUs in parallel with the specified number of processors OpenModelica#11808
- Build FMUs with the specified CC and CXX OpenModelica#11808

* Variable name
adrpo added a commit that referenced this issue Feb 1, 2024
* Various FMU fixes
- Use the last identifier in the model path for the FMU build #11554
- Build FMUs in parallel with the specified number of processors #11808
- Build FMUs with the specified CC and CXX #11808

* Variable name
@casella
Copy link
Contributor Author

casella commented Feb 1, 2024

Merged into maintenance/v1.22 in #11923

@casella casella closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/FMI Issue and pull request related to FMI export
Projects
Status: Done
Development

No branches or pull requests

4 participants