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

Implementation of the STEMMUS_SCOPE BMI, +docs +gprc4bmi #89

Merged
merged 44 commits into from Jan 31, 2024
Merged

Conversation

BSchilperoort
Copy link
Contributor

@BSchilperoort BSchilperoort commented Nov 17, 2023

This is the full implementation of the STEMMUS_SCOPE Basic Model Interface in Python, built upon the Matlab Compiler Runtime (MCR) executable file generated on Snellius.

The communication goes through an open subprocess of STEMMUS_SCOPE running in "interactive" mode (see EcoExtreML/STEMMUS_SCOPE#208). As overhead of MCR starting up is about 5 seconds.

Based on the state that the model wrote to file (the entire workspace), all requires functions including getters and setters can be implemented. With h5py the state file can be modified in-place. This makes the Python overhead per time step <0.10 seconds.

Todo:

  • Add time functionality
  • Add update_until
  • Check if all required grid functions are implemented
  • Add set/get value at indices

As a follow up to this PR, the variable list can be extended (see EcoExtreML/STEMMUS_SCOPE#209).

Additionally, the model (with the MCR dependencies) can be packaged in a container. This will allow for:

  1. communicating with the container directly from Python (using the BMI of this PR). Done!
  2. extending the image of 1. and adding this BMI + grpc4bmi to make the model compatible with systems such as eWaterCycle. Done!

Update:

The main way of running the BMI is now through docker. Tests with the docker image communication run on CI, allowing us to test the entire BMI interface.
A local option is still available (if you run Linux), which is also required to be able to make a grpc4bmi container.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@BSchilperoort BSchilperoort marked this pull request as ready for review November 29, 2023 07:17
@BSchilperoort
Copy link
Contributor Author

@SarahAlidoost this PR is also ready to review. It should be compatible with the STEMMUS_SCOPE executable in the PR there. Do note that you'll have to mark that file as executable ("allow executing file as program").

Copy link
Member

@SarahAlidoost SarahAlidoost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BSchilperoort thanks 👍 I was able to run the bmi with local exe but not with docker. please see my comments. One more point, can you please move all bmi and docker to a directory e.g. "bmi"? Another one, if we can pull the image automatically?

@BSchilperoort BSchilperoort changed the title First implementation of the STEMMUS_SCOPE BMI Implementation of the STEMMUS_SCOPE BMI, +docs +gprc4bmi Jan 26, 2024
docs/bmi.md Outdated Show resolved Hide resolved
docs/bmi.md Outdated Show resolved Hide resolved
docs/bmi.md Outdated Show resolved Hide resolved
docs/bmi.md Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Jan 30, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

78.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link
Member

@SarahAlidoost SarahAlidoost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BSchilperoort thanks for the fixes. I was able to run the notebook 🎉 Let's merge this PR 🚀

@BSchilperoort BSchilperoort merged commit 177b897 into main Jan 31, 2024
14 of 16 checks passed
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.

None yet

2 participants