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

Install and initialize Git LFS in testing/Dockerfile #614

Merged

Conversation

mattrobmattrob
Copy link
Contributor

This addition allows me to compile a Modelica + Spawn of EnergyPlus emulator without issues. Otherwise, there are EnergyPlus related linker errors due to a file that is unlikely to be correct on the filesystem:

/usr/bin/ld:/home/developer/git/modelica-buildings/Buildings/Resources/Library/linux64/[libModelicaBuildingsEnergyPlus.so](http://libmodelicabuildingsenergyplus.so/): file format not recognized; treating as linker script

Fixes #613.

This addition allows me to compile a Modelica + Spawn of EnergyPlus emulator without issues. Otherwise, there are EnergyPlus related linker errors due to a file that is unlikely to be correct on the filesystem:

```
/usr/bin/ld:/home/developer/git/modelica-buildings/Buildings/Resources/Library/linux64/[libModelicaBuildingsEnergyPlus.so](http://libmodelicabuildingsenergyplus.so/): file format not recognized; treating as linker script
```

Fixes ibpsa#613.

Signed-off-by: Matt Robinson <mattrob@hey.com>
Signed-off-by: Matt Robinson <mattrob@hey.com>
@dhblum
Copy link
Collaborator

dhblum commented Feb 3, 2024

Thanks @mattrobmattrob. This is good to know. But testing/Docker is setup to use JModelica as test case compiler, which I never thought would be able to compile Spawn models. Or are you testing and finding it can? Or using a different tool with that Dockerfile as a starting environment?

@mattrobmattrob
Copy link
Contributor Author

mattrobmattrob commented Feb 3, 2024

Thanks @mattrobmattrob. This is good to know. But testing/Docker is setup to use JModelica as test case compiler, which I never thought would be able to compile Spawn models. Or are you testing and finding it can? Or using a different tool with that Dockerfile as a starting environment?

My test case is moving https://github.com/henze-research-group/MODRLC/tree/actb/testcases/spawnrefsmalloffice into the BOPTEST testcases directory then running cd testing/ && make compile_testcase_model TESTCASE=spawnrefsmalloffice. So, AFAIK (but I'm very new to all this) it should be using the default JModelica compilation pipeline.

I just got compilation working so will update this PR slightly and push an example branch similar to #569 (or probably just try it on that PR's branch, actually).

@mattrobmattrob
Copy link
Contributor Author

You can check out https://github.com/ibpsa/project1-boptest/compare/master...mattrobmattrob:mr/add.spawnrefsmalloffice.emulator?expand=1 if you want to see what is working for me with cd testing && make build_jm_image && make compile_testcase_model TESTCASE=spawnrefsmalloffice, @dhblum

@dhblum
Copy link
Collaborator

dhblum commented Feb 5, 2024

I see. I did a quick test to compile the model with your fork and indeed got the wrapped.fmu. But when I try to deploy the testcase with TESTCASE=spawnrefsmalloffice docker-compose up the log shows a problem:

boptest_1  | 02/05/2024 03:21:14 PM UTC	root                ERROR	Failed to initialize test simulation: Traceback (most recent call last):
boptest_1  |   File "/home/user/testcase.py", line 169, in __simulation
boptest_1  |     res = self.fmu.simulate(start_time=start_time,
boptest_1  |   File "src/pyfmi/fmi.pyx", line 7573, in pyfmi.fmi.FMUModelCS2.simulate
boptest_1  |   File "src/pyfmi/fmi.pyx", line 378, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "src/pyfmi/fmi.pyx", line 372, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/fmi_algorithm_drivers.py", line 1006, in __init__
boptest_1  |     self.model.initialize()
boptest_1  |   File "src/pyfmi/fmi.pyx", line 4832, in pyfmi.fmi.FMUModelBase2.initialize
boptest_1  |   File "src/pyfmi/fmi.pyx", line 4826, in pyfmi.fmi.FMUModelBase2.initialize
boptest_1  |   File "src/pyfmi/fmi.pyx", line 4774, in pyfmi.fmi.FMUModelBase2.enter_initialization_mode
boptest_1  | pyfmi.fmi.FMUException: Enter Initialize returned with an error. Check the log for information (model.get_log).

When I look at wrapped_log.txt in the container it shows:

FMIL: module = Model, log level = 3: [WARNING][FMU status:Warning]     <ModelicaError category="warning"><value name="msg">"Failed to find spawn executable '%s' in Buildings Library installation, on SPAWNPATH and on PATH."</value></ModelicaError>
FMIL: module = Model, log level = 2: [INFO][FMU status:Error]     Initialization failed.

@mattrobmattrob Are you seeing this error too? I haven't done alot of testing of Spawn compilation and running in BOPTEST myself actually so I'd have to defer to someone who has or look more deeply myself to provide any guidance at this point.

@mattrobmattrob
Copy link
Contributor Author

@mattrobmattrob Are you seeing this error too? I haven't done alot of testing of Spawn compilation and running in BOPTEST myself actually so I'd have to defer to someone who has or look more deeply myself to provide any guidance at this point.

Thanks for checking that, @dhblum! Yup, this is the beginning of the changes for that particular model. I can get it running with this added to, for example, the boptest-service/worker/Dockerfile:

RUN mkdir -p /SpawnResources/
COPY boptest/testcases/spawnrefsmalloffice/models/SpawnResources/ /SpawnResources/
ENV SPAWNPATH /SpawnResources

But that's just my temporary hack. I plan to fix it up to use the Spawn binary that you mentioned but haven't gotten there yet:

# Install commands for Spawn
ENV SPAWN_VERSION=0.3.0-8d93151657
RUN wget https://spawn.s3.amazonaws.com/custom/Spawn-$SPAWN_VERSION-Linux.tar.gz \
&& tar -xzf Spawn-$SPAWN_VERSION-Linux.tar.gz \
&& ln -s /Spawn-$SPAWN_VERSION-Linux/bin/spawn-$SPAWN_VERSION /usr/local/bin/

Either way, this testing/Dockerfile is checking out repos with Git LFS artifacts that aren't being checked out properly so IMO this change is good on its own as it makes the state of those git checkouts more correct. Regardless of its impact on a Spawn emulation.

releasenotes.md Outdated Show resolved Hide resolved
Co-authored-by: Matt Robinson <mattrob@hey.com>
@dhblum
Copy link
Collaborator

dhblum commented Feb 5, 2024

Thanks @mattrobmattrob. I agree making sure Git LFS artifacts are checked out properly for repos is good generally and accepted your suggested edit to the release notes. I'll merge this and close #613, but keep in touch with how you make out compiling and simulating the spawn-based model with the JModelica-based compilation workflow in this repo.

@dhblum dhblum enabled auto-merge February 5, 2024 18:16
@dhblum dhblum merged commit f1c71b0 into ibpsa:master Feb 6, 2024
1 check passed
@mattrobmattrob mattrobmattrob deleted the mr/correct.compilation.git.lfs.config branch February 16, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Git LFS not installed/initialized in testing/Dockerfile
2 participants