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 bigger dtypes in routed models to expand number of supported pixels and implement docker container #1434

Conversation

phargogh
Copy link
Member

@phargogh phargogh commented Oct 21, 2023

Updates stack (and a little heap) memory usage to expand the raster sizes our routing functions can support.

Fixes #1431
Fixes #1115

Checklist

  • Updated HISTORY.rst and link to any relevant issue (if these changes are user-facing)
    - [ ] Updated the user's guide (if needed)
    - [ ] Tested the Workbench UI (if relevant)

This comes at a near-doubling of required stack memory (and some heap
memory), but it should be OK for most users.  RE:natcap#1431
@phargogh phargogh changed the title Bugfix/1431 sdr and probably other routed models have int32 limitations Update compiled memory usage in routed models to expand number of supported pixels Oct 21, 2023
@phargogh phargogh changed the title Update compiled memory usage in routed models to expand number of supported pixels Use bigger dtypes in routed models to expand number of supported pixels Oct 21, 2023
@phargogh phargogh changed the title Use bigger dtypes in routed models to expand number of supported pixels Use bigger dtypes in routed models to expand number of supported pixels and implement docker container Oct 21, 2023
…431-sdr-and-probably-other-routed-models-have-int32-limitations

Conflicts:
	HISTORY.rst
…nt32-limitations' of github.com:phargogh/invest into bugfix/1431-sdr-and-probably-other-routed-models-have-int32-limitations
@phargogh phargogh self-assigned this Oct 24, 2023
…431-sdr-and-probably-other-routed-models-have-int32-limitations

Conflicts:
	HISTORY.rst
…nt32-limitations' of github.com:phargogh/invest into bugfix/1431-sdr-and-probably-other-routed-models-have-int32-limitations
… version incompatibility that I encountered in github actions. RE:natcap#1431
When running on github actions, I found an error noting that `Hook
already exists: pre-push` (see below), which to me makes me think that
LFS already exists and has been configured.  And I confirm that on GHA,
git-lfs is installed to version 3.4.0

```
git -C data/invest-test-data lfs install
Hook already exists: pre-push

	#!/bin/sh
	command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
	git lfs pre-push "$@"

To resolve this, either:
  1: run `git lfs update --manual` for instructions on how to merge hooks.
  2: run `git lfs update --force` to overwrite your hook.
```
@phargogh phargogh marked this pull request as ready for review October 24, 2023 20:40
@phargogh phargogh requested a review from dcdenu4 October 24, 2023 20:40
Copy link
Member

@dcdenu4 dcdenu4 left a comment

Choose a reason for hiding this comment

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

Thanks @phargogh, I mostly left comments that was me talking to myself about what was taking place. The only thing I wanted to get your thoughts on was whether we should update the README with information about the docker container, or if a README should go in docker/ folder. Essentially, it would be nice to have some instruction on how to use the container for running InVEST. But that could also be it's own issue outside of this PR.

on:
workflow_dispatch:
push:
paths:
Copy link
Member

Choose a reason for hiding this comment

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

paths here is a filter indicating we only run when a file in one of these paths has changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, exactly. So the idea here was to only rebuild the container if there's something that will change the output of a model, like the source code, requirements, etc.

HISTORY.rst Show resolved Hide resolved
Makefile Outdated
@@ -196,15 +196,15 @@ $(GIT_UG_REPO_PATH):
$(GIT_SAMPLE_DATA_REPO_PATH): | $(DATA_DIR)
-git clone $(GIT_SAMPLE_DATA_REPO) $(GIT_SAMPLE_DATA_REPO_PATH)
git -C $(GIT_SAMPLE_DATA_REPO_PATH) fetch
git -C $(GIT_SAMPLE_DATA_REPO_PATH) lfs install
-git -C $(GIT_SAMPLE_DATA_REPO_PATH) lfs install
Copy link
Member

Choose a reason for hiding this comment

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

What's the argument for suppressing errors and continuing to install here? I'm wondering the same for above with the git clone command. Wouldn't we want to fail if this fails?

Copy link
Member Author

@phargogh phargogh Oct 25, 2023

Choose a reason for hiding this comment

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

Well, the git clone one, is pretty clear ... if the repo already exists at that path, git clone will fail and that's ok. It's more straightforward to do this than to handle the cross-platform if/else within the recipe.

For git lfs install, this one was failing (as far as I could tell) because git lfs is already installed and had installed some kind of hook that reinstallation would overwrite. But now that I'm looking for the failing builds, I'm less convinced that skipping on failure here is needed. Removing this in cd492aa

Copy link
Member

Choose a reason for hiding this comment

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

if the repo already exists at that path, git clone will fail and that's ok. It's more straightforward to do this than to handle the cross-platform if/else within the recipe.

Ah, of course. That makes sense, thanks for the reminder.

Comment on lines +5 to +6
ARG INVEST_VERSION="main"
ARG INVEST_REPO="natcap/invest"
Copy link
Member

Choose a reason for hiding this comment

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

Cool, we're updating these placeholders from the GHA workflow call.

Copy link
Member

@dcdenu4 dcdenu4 left a comment

Choose a reason for hiding this comment

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

Thanks @phargogh excited to see the container workflow in practice!

@dcdenu4 dcdenu4 merged commit c920d46 into natcap:main Oct 26, 2023
25 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.

SDR and probably other routed models have int32 limitations Proposal: create a docker container for InVEST
2 participants