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

Docker image for top level directory #4

Merged
merged 8 commits into from
Sep 2, 2021
Merged

Docker image for top level directory #4

merged 8 commits into from
Sep 2, 2021

Conversation

elynnwu
Copy link
Collaborator

@elynnwu elynnwu commented Aug 26, 2021

Added docker image from the top level that includes fv3core, fv3gfs-physics, and fv3gfs-util.

  1. Copied most top level files in fv3core to fv3gfs-integration
  2. Changed docker image name to fv3gfs-integration
  3. Generated new constraints file based on the requirements in all three folders
  4. Added test data symbol link to allow fv3core pytest to run with make savepoint_tests or manually through make dev && pytest -v -s --data_path=/test_data/ /port_dev/tests

@elynnwu elynnwu requested a review from mcgibbon August 26, 2021 17:19
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Outdated
Comment on lines 88 to 89
constraints.txt: requirements.txt requirements/requirements_wrapper.txt requirements/requirements_lint.txt
pip-compile $^ --output-file constraints.txt
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably look at requirements files in its subdirectories, rather than having copies of those requirements files, to avoid duplicating data. It can include requirements not just from fv3core, but also from fv3gfs-util and fv3gfs-physics.

This isn't to say there shouldn't be any requirements files at the top level (esp for linting or for running the top-level integration tests), it's just that if requirements get updated for fv3core then ideally we should only need to update the fv3core requirements in the fv3core directory.

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 point. It now reads the requirement data for the individual repository.

Makefile Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
docker/Makefile.image_names Outdated Show resolved Hide resolved
Comment on lines 4 to 7
pip install -r requirements.txt
pip install -e /fv3gfs-util
pip install -e /fv3core
pip install -e /fv3gfs-physics
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do these need a -c constraints.txt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think so because the docker image already installed the requirements with constraints.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd ask to add -c constraints.txt. I'd expect this wouldn't update the packages, but I'm not confident that pip install package==version followed by pip install package will never upgrade it. And it's possible for an error or refactor to cause the requirements to no longer be installed during the docker build.


## Build FMS
##---------------------------------------------------------------------------------
FROM fv3gfs-environment AS fv3gfs-fms-install
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note that if you remove fv3gfs-wrapper from this level as I suggested in another comment, it will also involve removing the FMS and ESMF stages, and fv3gfs-build, and maybe also fv3gfs-environment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FMS, ESMF, fv3gfs-build, and fv3gfs-environment are removed.

Copy link
Collaborator

@mcgibbon mcgibbon left a comment

Choose a reason for hiding this comment

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

So much cleaner now! We also talked about removing the test data link from the top level, since you will already have access to the test data through the fv3core/fv3gfs-physics mounts. You may want to add the test arguments you run inside the dev image to the README so others can conveniently copy-paste them as needed.

@@ -0,0 +1 @@
v30
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a good design, but you should communicate to the team that the integration, physics, and dycore have separate pins of the gt4py version.

Makefile Outdated
Comment on lines 12 to 13
FV3=fv3core
FV3_PATH ?=/$(FV3)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The $(FV3) variable is only used here.

Suggested change
FV3=fv3core
FV3_PATH ?=/$(FV3)
FV3_PATH ?=/fv3core

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually we don't need these variables anymore, deleted

Makefile Outdated
Comment on lines 14 to 15
PHY=fv3gfs-physics
PHY_PATH ?=/$(PHY)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The $(PHY) variable is only used here.

Suggested change
PHY=fv3gfs-physics
PHY_PATH ?=/$(PHY)
PHY_PATH ?=/fv3gfs-physics

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

Makefile Outdated
PULL ?=True
CONTAINER_ENGINE ?=docker
TEST_DATA_HOST ?=$(CWD)/test_data/$(EXPERIMENT)
FV3UTIL_DIR=$(CWD)/fv3gfs-util
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unused.

Suggested change
FV3UTIL_DIR=$(CWD)/fv3gfs-util

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as before

Makefile Outdated
dev:
docker run --rm -it \
--network host \
-v $(TEST_DATA_HOST):$(TEST_DATA_RUN_LOC) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest removing the test data link from the integration dev entrypoint, to avoid adding a third place (physics, dynamics and integration) that depends on this test data. This entrypoint is the only place where you still have a dependency.

We can always specify an additional -v flag manually to mount this data if we want to use it inside the integrations image while developing.

On that note, I think you should add a RUN_ARGS ?= --rm flag to this file and use it in this make target, to give a clear way to add additional docker run arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test data mount is removed, updated documentation to point to test data. RUN_ARGS added.

docker/Makefile Outdated
Comment on lines 42 to 48
build_core_deps: ## build container images of dependencies
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(MPI_IMAGE) $(BUILD_ARGS) --target fv3gfs-mpi ../external/fv3gfs-fortran
$(MAKE) build_core_env
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(SERIALBOX_IMAGE) $(BUILD_ARGS) --target fv3gfs-environment-serialbox .

build_core_env:
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(ENVIRONMENT_IMAGE) $(BUILD_ARGS) --target fv3gfs-environment .
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like build_core_env only appears here, this would make the lines a bit more uniform.

nit: could you rename each of these to remove core? I believe this was meant to refer to fv3core. As mentioned in the other comment, it doesn't look like there's a need to separate dependencies into two groups here.

Suggested change
build_core_deps: ## build container images of dependencies
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(MPI_IMAGE) $(BUILD_ARGS) --target fv3gfs-mpi ../external/fv3gfs-fortran
$(MAKE) build_core_env
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(SERIALBOX_IMAGE) $(BUILD_ARGS) --target fv3gfs-environment-serialbox .
build_core_env:
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(ENVIRONMENT_IMAGE) $(BUILD_ARGS) --target fv3gfs-environment .
build_core_deps: ## build container images of dependencies
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(MPI_IMAGE) $(BUILD_ARGS) --target fv3gfs-mpi ../external/fv3gfs-fortran
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(ENVIRONMENT_IMAGE) $(BUILD_ARGS) --target fv3gfs-environment .
docker build -f $(DEPENDENCIES_DOCKERFILE) -t $(SERIALBOX_IMAGE) $(BUILD_ARGS) --target fv3gfs-environment-serialbox .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Consolidated to deps, no more reference to core_deps

Comment on lines 14 to 16
#RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \
# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 && \
# update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-8 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please delete these commented lines.

Comment on lines 68 to 70
#RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \
# update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 && \
# update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-8 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

Comment on lines 4 to 7
pip install -r requirements.txt
pip install -e /fv3gfs-util
pip install -e /fv3core
pip install -e /fv3gfs-physics
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd ask to add -c constraints.txt. I'd expect this wouldn't update the packages, but I'm not confident that pip install package==version followed by pip install package will never upgrade it. And it's possible for an error or refactor to cause the requirements to no longer be installed during the docker build.

requirements.txt Show resolved Hide resolved
Copy link
Collaborator

@mcgibbon mcgibbon left a comment

Choose a reason for hiding this comment

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

LGTM!

@elynnwu elynnwu merged commit 669a616 into main Sep 2, 2021
@elynnwu elynnwu deleted the add-docker branch September 2, 2021 02:00
mcgibbon pushed a commit that referenced this pull request Nov 12, 2021
Update dwind phys is an object
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.

2 participants