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

Initial implementation of Linux support. #71

Merged
merged 16 commits into from
Dec 21, 2023
Merged

Conversation

gedaskir
Copy link
Collaborator

@gedaskir gedaskir commented Dec 10, 2023

This is initial implementation of MIKE IO 1D working on Linux. The main changes are related to deployment of the package:

  • When release is triggered two virtual machine instances are started, which build platform specific wheels, i.e.
    • manylinux2010_x86_64 (note that we do not perform auditwheel and only a rename from linux_x86_64 to manylinux2010_x86_64 is done).
    • win_amd64
  • Dependency on DHI.MikeCore.Linux.rhel7 20.0.0 NuGet package is added for Linux.
  • The runtimeconfig.json is instructed to use latest available .NET version in the system by using "rollForward": "LatestMajor" option.

There are a few things, which I don't think are fully proper, but still I think it is a good idea to already merge it in into main:

  • For example, the mikecore-python package dependency should not be necessary. I use it here because it helped to resolve the native libraries correctly, because mikecore-python is deployed with patchelfed libraries. To my understanding setting LD_LIBRARY_PATH in Python process environment does not really help as per this thread:
    https://stackoverflow.com/questions/23244418/set-ld-library-path-before-importing-in-python
    For now we have MIKE Core binaries in two places.

  • Another thing is the strict requirement of .NET Core 3.1 presence. In principle it should work with any .NET 5 and above.

  • Having 10 checks in GitHub actions maybe is a bit too much. Additionally, we get Python.NET not closing properly once in a while and failing tests (some garbage collector failure).

Copy link
Collaborator

@ryan-kipawa ryan-kipawa left a comment

Choose a reason for hiding this comment

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

This is exciting :) ... I really look forward to being able to use mikeio1d with linux soon. It'll simplify installing some of the optional dependencies (like geopandas), as well as allow things like devcontainers.

These are my main comments:

  • Should we add MacOS at the same time? I also wondered about testing a few other linux distros, but it seems github actions only includes ubuntu as convenience.
  • I think we should include some high-level end-to-end tests that show expected results are returned regardless of the OS. These could compare all timeseries results for a few different files to what is expected. We could mark these as 'slow' tests that are only run when merging into main.

@ecomodeller
Copy link
Member

This is exciting :) ... I really look forward to being able to use mikeio1d with linux soon. It'll simplify installing some of the optional dependencies (like geopandas), as well as allow things like devcontainers.

These are my main comments:

  • Should we add MacOS at the same time? I also wondered about testing a few other linux distros, but it seems github actions only includes ubuntu as convenience.
  • I think we should include some high-level end-to-end tests that show expected results are returned regardless of the OS. These could compare all timeseries results for a few different files to what is expected. We could mark these as 'slow' tests that are only run when merging into main.

I don't think that https://www.nuget.org/packages/DHI.MikeCore.Linux.rhel7 will work on Mac OS, but I am happy to be proven wrong🙂.

@@ -26,7 +27,7 @@ jobs:
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '5.0'
dotnet-version: '3.1.x'
Copy link
Member

Choose a reason for hiding this comment

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

.NET 3.1 reached end-of-life in 2022😳

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently the runtime.json we get when building MIKE 1D has this version set. I kept the things simple and did not fiddle around with it yet. For netstandard dlls which we use in MIKE IO 1D it should not be relevant. In principle it is possible to specify several runtimes as per
https://github.com/dotnet/sdk/blob/main/documentation/specs/runtime-configuration-file.md

We would need to check how Python.NET handles it, etc. Feel free to experiment, maybe everything works out of the box :-). I just set this version, because it was certain that it will work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ecomodeller I updated the runtimeconfig.json to use latest available .NET runtime and setup-dotnet@v3 to use .NET 6.0. Apparently was quite simple :-).

@gedaskir
Copy link
Collaborator Author

gedaskir commented Dec 11, 2023

  • I think we should include some high-level end-to-end tests that show expected results are returned regardless of the OS. These could compare all timeseries results for a few different files to what is expected. We could mark these as 'slow' tests that are only run when merging into main.

@rywm-dhi This is a good idea. I think we could simply dump the present res1d, etc. files as csv or similar, check that content of it is proper, and compare against that. I don't even think that will be a slow test :-).

@ecomodeller
Copy link
Member

💖🚀

I can review the code in a codespace. Well done!
image

Gediminas Kirsanskas added 2 commits December 15, 2023 14:41
@gedaskir
Copy link
Collaborator Author

gedaskir commented Dec 15, 2023

@rywm-dhi The newly introduced test_core.py fails now, because of the slight differences in the date time indices (for example, '1994-08-07 16:36:01.869000' vs. '1994-08-07 16:36:01.870000'). It is not fully clear if it is a rounding, different MIKE Core version (on Linux we use version 20.0, because that is the only available in NuGet now), running Linux vs. Windows, or etc. issue. Note that the time is stored as seconds after simulation start time in 64-bit float, so from first glance it does not seem like the lack of precision rounding error (the simulation start is '1994-08-07 16:35:00').

…een .NET and Python date times.

Still round to millisecond precision to keep the old behaviour.
@ryan-kipawa
Copy link
Collaborator

@rywm-dhi The newly introduced test_core.py fails now, because of the slight differences in the date time indices (for example, '1994-08-07 16:36:01.869000' vs. '1994-08-07 16:36:01.870000'). It is not fully clear if it is a rounding, different MIKE Core version (on Linux we use version 20.0, because that is the only available in NuGet now), running Linux vs. Windows, or etc. issue. Note that the time is stored as seconds after simulation start time in 64-bit float, so from first glance it does not seem like the lack of precision rounding error (the simulation start is '1994-08-07 16:35:00').

I installed the branch on WSL (Ubuntu 22.04) with Python 3.12.1, using .NET v6.0. The "off by one test" fails actually. When I remove the one tick adjustment, it passes.

Update CHANGELOG and README with Linux support.
@gedaskir gedaskir marked this pull request as ready for review December 18, 2023 14:41
README.md Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we hint that dotnet is required if installing with linux? Maybe add a quick shortcut sudo apt install dotnet-sdk-7.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a good idea.

@gedaskir gedaskir merged commit 252eb22 into main Dec 21, 2023
4 checks passed
ryan-kipawa pushed a commit that referenced this pull request Oct 11, 2024
Initial implementation of Linux support.
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.

3 participants