Skip to content

Commit

Permalink
Bump base Ubuntu image
Browse files Browse the repository at this point in the history
This bumps the base Ubuntu image used to one with a version of 20.04. The
pinned SHA makes things consistent with the base image we use when building the
prognostic run in fv3net.

Note that due to NOAA-EMC/fv3atm#33, the tests with the TKE-EDMF scheme active
fail in debug mode.  We currently mark them as expected failures.  To
demonstrate that answers do not change when we fix this bug, we run the
coarse-graining tests in repro mode here and checkpoing the checksums.  In a
followup commit, we will fix the bug, unmark the relevant debug mode tests, but
retain the repro mode tests to demonstrate that the tests still all pass
without modifying those checksums.  Finally in one last commit we will remove
those temporary repro mode tests as well as their checksums, as they will no
longer be needed.

Because the serialize_image fails to build with the new compilers, we also
elect to remove the infrastructure and tests associated with it.
  • Loading branch information
spencerkclark committed Apr 28, 2023
1 parent cb106f2 commit 9961a82
Show file tree
Hide file tree
Showing 13 changed files with 444 additions and 2,901 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
command: |
git submodule init
git submodule update
- run: DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=plain BUILD_FROM_INTERMEDIATE=y make build build_debug build_serialize
- run: DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=plain BUILD_FROM_INTERMEDIATE=y make build build_debug
- restore_cache:
keys:
- v1.4-{{ checksum "requirements.txt"}}
Expand Down
31 changes: 10 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ OTHER_MOUNTS ?=

# base images w/ or w/o CUDA
ifeq ($(CUDA),n)
BASE_IMAGE ?=ubuntu:18.04
DEP_TAG_NAME ?=gnu7-mpich314-nocuda
# Note this BASE_IMAGE version is the same as the one used in the
# fv3net prognostic_run image. It corresponds to an image with Ubuntu
# version 20.04.
BASE_IMAGE ?=ubuntu@sha256:9101220a875cee98b016668342c489ff0674f247f6ca20dfc91b91c0f28581ae
DEP_TAG_NAME ?=gnu9-mpich314-nocuda
else
BASE_IMAGE ?=nvidia/cuda:10.2-devel-ubuntu18.04
DEP_TAG_NAME ?=gnu7-mpich314-cuda102
Expand All @@ -24,21 +27,19 @@ BUILD_ARGS += --build-arg BASE_IMAGE=$(BASE_IMAGE)
# image names (use XXX_IMAGE=<name> make <target> to override)
COMPILED_TAG_NAME ?=$(DEP_TAG_NAME)
COMPILED_IMAGE ?= $(GCR_URL)/$(COMPILE_TARGET):$(COMPILED_TAG_NAME)
SERIALIZE_IMAGE ?= $(GCR_URL)/$(COMPILE_TARGET):$(COMPILED_TAG_NAME)-serialize
EMULATION_IMAGE ?= $(GCR_URL)/$(COMPILE_TARGET):$(COMPILED_TAG_NAME)-emulation
ENVIRONMENT_IMAGE ?= $(GCR_URL)/$(ENVIRONMENT_TARGET):$(ENVIRONMENT_TAG_NAME)
MPI_IMAGE ?= $(GCR_URL)/mpi-build:$(DEP_TAG_NAME)
FMS_IMAGE ?= $(GCR_URL)/fms-build:$(DEP_TAG_NAME)
ESMF_IMAGE ?= $(GCR_URL)/esmf-build:$(DEP_TAG_NAME)
SERIALBOX_IMAGE ?= $(GCR_URL)/serialbox-build:$(DEP_TAG_NAME)

# used to shorten build times in CircleCI
ifeq ($(BUILD_FROM_INTERMEDIATE),y)
BUILD_ARGS += --build-arg FMS_IMAGE=$(FMS_IMAGE) --build-arg ESMF_IMAGE=$(ESMF_IMAGE) --build-arg SERIALBOX_IMAGE=$(SERIALBOX_IMAGE) --build-arg MPI_IMAGE=$(MPI_IMAGE)
BUILD_ARGS += --build-arg FMS_IMAGE=$(FMS_IMAGE) --build-arg ESMF_IMAGE=$(ESMF_IMAGE) --build-arg MPI_IMAGE=$(MPI_IMAGE)
endif

.PHONY: help build build_environment build_compiled build_serialize build_debug
.PHONY: build_deps push_deps pull_deps enter enter_serialize test update_circleci_reference clean
.PHONY: help build build_environment build_compiled build_debug
.PHONY: build_deps push_deps pull_deps enter test update_circleci_reference clean

help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Expand All @@ -60,41 +61,29 @@ build_compiled: ## build production container image
build_debug: ## build container image for debugging
COMPILED_TAG_NAME=$(COMPILED_TAG_NAME)-debug COMPILE_OPTION="REPRO=\\\nDEBUG=Y" $(MAKE) build

build_serialize: ## build container image for serialization
BUILD_ARGS="$(BUILD_ARGS) --build-arg serialize=true" \
COMPILED_IMAGE=$(SERIALIZE_IMAGE) \
$(MAKE) build_compiled

build_deps: ## build container images of dependnecies (FMS, ESMF, SerialBox)
build_deps: ## build container images of dependnecies (FMS, ESMF)
docker build -f $(DOCKERFILE) -t $(MPI_IMAGE) $(BUILD_ARGS) --target fv3gfs-mpi .
docker build -f $(DOCKERFILE) -t $(FMS_IMAGE) $(BUILD_ARGS) --target fv3gfs-fms .
docker build -f $(DOCKERFILE) -t $(ESMF_IMAGE) $(BUILD_ARGS) --target fv3gfs-esmf .
docker build -f $(DOCKERFILE) -t $(SERIALBOX_IMAGE) $(BUILD_ARGS) --target fv3gfs-environment-serialbox .

push_image_%:
docker tag $(GCR_URL)/$*:$(DEP_TAG_NAME) $(GCR_URL)/$*:$(DEP_TAG_NAME)-$(COMMIT_SHA)
docker push $(GCR_URL)/$*:$(DEP_TAG_NAME)
docker push $(GCR_URL)/$*:$(DEP_TAG_NAME)-$(COMMIT_SHA)

## push container images of dependencies to GCP
push_deps: push_image_mpi-build push_image_fms-build push_image_esmf-build push_image_serialbox-build
push_deps: push_image_mpi-build push_image_fms-build push_image_esmf-build

pull_deps: ## pull container images of dependencies from GCP (for faster builds)
docker pull $(MPI_IMAGE)
docker pull $(FMS_IMAGE)
docker pull $(ESMF_IMAGE)
docker pull $(SERIALBOX_IMAGE)

enter: ## run and enter production container for development
docker run --rm \
-v $(shell pwd)/FV3:/FV3 $(OTHER_MOUNTS) \
-w /FV3 -it $(COMPILED_IMAGE) bash

enter_serialize: ## run and enter serialization container for development
docker run --rm \
-v $(shell pwd)/FV3:/FV3/original $(OTHER_MOUNTS) \
-w /FV3 -it $(SERIALIZE_IMAGE) bash

test: ## run tests (set COMPILED_TAG_NAME to override default)
pytest tests/pytest --capture=no --verbose --refdir $(shell pwd)/tests/pytest/reference/circleci --image_version $(COMPILED_TAG_NAME)

Expand Down
96 changes: 9 additions & 87 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ARG serialize=false
ARG fv3_build_env_tag=standard
ARG BASE_IMAGE
ARG MPI_IMAGE=fv3gfs-mpi
ARG FMS_IMAGE=fv3gfs-fms
ARG ESMF_IMAGE=fv3gfs-esmf
ARG SERIALBOX_IMAGE=fv3gfs-environment-serialbox

FROM $BASE_IMAGE AS fv3gfs-mpi

Expand All @@ -25,7 +22,8 @@ RUN wget -q http://www.mpich.org/static/downloads/3.1.4/mpich-3.1.4.tar.gz && \
FROM $MPI_IMAGE AS mpi_image

FROM $BASE_IMAGE AS fv3gfs-environment
RUN apt-get update && apt-get install -y \
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata && \
apt-get install -y \
wget \
gcc \
libtool-bin \
Expand Down Expand Up @@ -55,53 +53,6 @@ RUN git config --global http.sslverify false && \
git checkout 3da51e139d5cd731c9fc27f39d88cb4e1328212b && \
echo "y" | ./make_ncep_libs.sh -s linux -c gnu -d /opt/NCEPlibs -o 1

##
## Setup environment for Serialbox
##---------------------------------------------------------------------------------
FROM fv3gfs-environment as fv3gfs-environment-serialbox
# set TZ
ENV DEBIAN_FRONTEND=noninteractive TZ=US/Pacific
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# install dependencies for serialbox
RUN apt-get update && apt-get install -y \
libssl-dev \
clang \
clang-format \
clang-tidy \
python3-numpy \
python3-nose \
python3-sphinx

# RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.18.3/cmake-3.18.3-Linux-x86_64.sh && \
# chmod +x ./cmake-3.18.3-Linux-x86_64.sh && \
# cmake-3.18.3-Linux-x86_64.sh

RUN wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3.tar.gz && \
tar xzf cmake-3.17.3.tar.gz && \
cd cmake-3.17.3 && \
./bootstrap && make -j4 && make install

# Install headers from the Boost library
RUN wget -q https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz && \
tar xzf boost_1_74_0.tar.gz && \
cd boost_1_74_0 && \
cp -r boost /usr/include/ && cd /

# install serialbox from source
COPY serialbox serialbox
RUN cd serialbox && \
mkdir build && \
cd build && \
cmake -DSERIALBOX_USE_NETCDF=ON -DSERIALBOX_ENABLE_FORTRAN=ON \
-DSERIALBOX_TESTING=ON ../ && \
make -j16 && \
make test && \
make install

# setup link for backwards comatibility
RUN ln -s /serialbox /serialbox2

## Build FMS
##---------------------------------------------------------------------------------
FROM fv3gfs-environment AS fv3gfs-fms
Expand Down Expand Up @@ -140,9 +91,9 @@ RUN git clone -b ESMF_8_0_0 --depth 1 https://git.code.sf.net/p/esmf/esmf $ESMF_
make install && \
make installcheck

## Copy FV3GFS sources for non-serialize image
## Copy FV3GFS sources
##---------------------------------------------------------------------------------
FROM $BASE_IMAGE AS fv3gfs-src-serialize-false
FROM $BASE_IMAGE AS fv3gfs-src

ARG compile_option
ARG configure_file=configure.fv3.gnu_docker
Expand All @@ -168,55 +119,28 @@ RUN cp /FV3/conf/$configure_file \

COPY FV3/atmos_cubed_sphere /FV3/atmos_cubed_sphere

## Convert FV3GFS sources for serialize image
##---------------------------------------------------------------------------------
FROM $SERIALBOX_IMAGE AS fv3gfs-src-serialize-true

ARG compile_option
ARG configure_file=configure.fv3.gnu_docker_serialize

ENV SERIALBOX_OUTDIR=/FV3
ENV FV3_BASE=/FV3/original

COPY --from=fv3gfs-src-serialize-false /FV3 $FV3_BASE
COPY --from=fv3gfs-src-serialize-false /stochastic_physics $(FV3_BASE)/../stochastic_physics

# copy appropriate configuration file to configure.fv3
RUN cp $FV3_BASE/conf/$configure_file \
$FV3_BASE/conf/configure.fv3 && \
if [ ! -z $compile_option ]; then sed -i "33i $compile_option" \
$FV3_BASE/conf/configure.fv3; fi && \
cd $FV3_BASE && \
make serialize_preprocess


## Convert FV3GFS sources for emulation image
##---------------------------------------------------------------------------------

FROM fv3gfs-src-serialize-$serialize AS fv3gfs-sources
FROM fv3gfs-src AS fv3gfs-sources

FROM $FMS_IMAGE AS fms_image
FROM $ESMF_IMAGE AS esmf_image
FROM $SERIALBOX_IMAGE AS serialbox_image

FROM fv3gfs-environment AS fv3gfs-environment-standard

## Build FV3 executable in its own image
##---------------------------------------------------------------------------------
FROM fv3gfs-environment-${fv3_build_env_tag} AS fv3gfs-build
FROM fv3gfs-environment-standard AS fv3gfs-build

ENV ESMFMKFILE=/usr/local/esmf/lib/esmf.mk

ENV SERIALBOX_DIR=/serialbox \
SERIALBOX_OUTDIR=/FV3 \
FMS_DIR=/FMS \
ENV FMS_DIR=/FMS \
ESMF_DIR=/usr/local/esmf

ENV ESMF_INC="-I/usr/local/esmf/include" \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ESMF_DIR}/lib:${FMS_DIR}/libFMS/.libs/:${SERIALBOX_DIR}/lib \
PPSER_PY=$(SERIALBOX_DIR)/python/pp_ser/pp_ser.py
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ESMF_DIR}/lib:${FMS_DIR}/libFMS/.libs

COPY --from=serialbox_image /serialbox/install $SERIALBOX_DIR
COPY --from=fms_image /FMS $FMS_DIR
COPY --from=esmf_image /usr/local/esmf $ESMF_DIR

Expand All @@ -235,9 +159,7 @@ FROM fv3gfs-build AS fv3gfs-compiled

RUN apt-get update && apt-get install -y \
python3 \
python3-pip && \
ln -s /bin/python3 /bin/python && \
ln -s /bin/pip3 /bin/pip
python3-pip
# install python packages needed to convert to netcdf data
RUN pip3 install --upgrade setuptools pip && \
pip3 install --no-cache-dir pyyaml xarray==0.16.2 f90nml==1.1.0 netCDF4
Expand Down
37 changes: 37 additions & 0 deletions tests/pytest/reference/circleci/baroclinic-debug/md5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
131fab4e3cd1feae7cb6bdaff881e725 atmos_4xdaily_fine_inst.tile1.nc
fe45eab4a5c25ec93a5a348ee08881a0 atmos_4xdaily_fine_inst.tile2.nc
fad54c07bf8692b0bb1296a189306dff atmos_4xdaily_fine_inst.tile3.nc
bdf349ecd9d8065fb7bc27d69b438c00 atmos_4xdaily_fine_inst.tile4.nc
1094331a6b0aa718e6509521ae268159 atmos_4xdaily_fine_inst.tile5.nc
d4b2fe8b386577cb3d2eeb9d7cd727e2 atmos_4xdaily_fine_inst.tile6.nc
82157501c5b777a6e51603f36d381a8c RESTART/fv_core.res.nc
3776fd756dace0f597ec422043c7f118 RESTART/fv_core.res.tile1.nc
f9fdbac96cf7a0fb09c6fef4e2529cff RESTART/fv_core.res.tile2.nc
9d34f5adfd62b4e47e35d85bd5a2af24 RESTART/fv_core.res.tile3.nc
a6feac056ec48e4ca8289d4180d8d396 RESTART/fv_core.res.tile4.nc
6654dcf19e08d45aff075cdf09148cf5 RESTART/fv_core.res.tile5.nc
7fe463915eec05ad8d003ea8304a3269 RESTART/fv_core.res.tile6.nc
fbeeab6ab11e26787de05bafb7853ab1 RESTART/fv_srf_wnd.res.tile1.nc
91e20c755b0f9545e73db907b1282706 RESTART/fv_srf_wnd.res.tile2.nc
b01f7387d64a8e49c94199892361e6de RESTART/fv_srf_wnd.res.tile3.nc
61affb199928a3b9e7b0ca351709083d RESTART/fv_srf_wnd.res.tile4.nc
f62cee640bc26fa4d5e9bf70b1104304 RESTART/fv_srf_wnd.res.tile5.nc
a08a35fd458971b5a4f2f81b3eba529f RESTART/fv_srf_wnd.res.tile6.nc
173da4ef4a258e778c47dd31271a3b8e RESTART/fv_tracer.res.tile1.nc
ee308d968032d9f83bac94957f68ea9f RESTART/fv_tracer.res.tile2.nc
c53da594d7e006ad0ef132410cd1f19b RESTART/fv_tracer.res.tile3.nc
0079487895fb0a593b52d8e760aa0614 RESTART/fv_tracer.res.tile4.nc
63f49f4d21ced8ba0fc50337271414d3 RESTART/fv_tracer.res.tile5.nc
3792fbcadc42564cd134495cf1e87381 RESTART/fv_tracer.res.tile6.nc
009eee5d146a8dd492bfc6052ccad11e RESTART/phy_data.tile1.nc
ed094092b41c9853bf85d84d43d1f7fd RESTART/phy_data.tile2.nc
e7122fe73228aca73a13c89a3d53f149 RESTART/phy_data.tile3.nc
ecc9f494e54293e09d50981300be7c26 RESTART/phy_data.tile4.nc
f6ac59fc70a90e246c28db7ee9da4c6d RESTART/phy_data.tile5.nc
8b15f645ac7f3fd52bcee6180edd1522 RESTART/phy_data.tile6.nc
e05299c68f47918b78d8df63aa939e22 RESTART/sfc_data.tile1.nc
5315048f47ab00fddf8834258fd2f080 RESTART/sfc_data.tile2.nc
05daf9a231493c752d251c676478744b RESTART/sfc_data.tile3.nc
1193578f82de05926290fbbf11099912 RESTART/sfc_data.tile4.nc
9c1e823605a277322c4231a5cedec333 RESTART/sfc_data.tile5.nc
7065033ee348c8f9d0f877b0712fbac7 RESTART/sfc_data.tile6.nc
37 changes: 0 additions & 37 deletions tests/pytest/reference/circleci/baroclinic/md5.txt

This file was deleted.

55 changes: 55 additions & 0 deletions tests/pytest/reference/circleci/default-debug/md5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
c018112e0d1e1df1233ba9fab96e979f atmos_8xdaily.tile1.nc
133739ee6ea94fd326bfe86b7c418915 atmos_8xdaily.tile2.nc
a9870ef35b3825112b94900c9d5a49c7 atmos_8xdaily.tile3.nc
1de7a0b835bf3837dd7186b2936ce2b0 atmos_8xdaily.tile4.nc
29680e8543976f9948795363d84aacc5 atmos_8xdaily.tile5.nc
32e6a4c763d97ae839b1ca577ab29c0c atmos_8xdaily.tile6.nc
0475f5c90dd6732c3fcc43a548701358 atmos_dt_atmos.tile1.nc
958564c9b59218f729d2968fdd74e19b atmos_dt_atmos.tile2.nc
d34a342fed93558e674c354fc76e6307 atmos_dt_atmos.tile3.nc
66b26cb495c7e5c38410872cfc61dd25 atmos_dt_atmos.tile4.nc
6ee25a090bcd2c7c54048d1f73c36845 atmos_dt_atmos.tile5.nc
64968e54803a5beeb15b92c2de78f922 atmos_dt_atmos.tile6.nc
8eb161a8cd002f6b4d22153b2f70d1e9 atmos_static.tile1.nc
ef1e925dfc78367952c956bdb7e1ceb4 atmos_static.tile2.nc
8d896f1374d26641eb88ee448db35fef atmos_static.tile3.nc
2ffd7708edd11a7f5b4d986237ef128b atmos_static.tile4.nc
69767c62e6861db5fc20ce34cda3d383 atmos_static.tile5.nc
2e112b68717697f780843d8a3a48e2cd atmos_static.tile6.nc
a063a03c4214c4412ef6214b5dcc17c8 sfc_dt_atmos.tile1.nc
8a4c4c9c6f5904c43440870d08d0e98a sfc_dt_atmos.tile2.nc
68a6c5e4d6b532f8ca58104d0096c5ee sfc_dt_atmos.tile3.nc
c4585b3c008e71487f00197688b62d90 sfc_dt_atmos.tile4.nc
23dfd38289cb3ce8ec4e2504e76e405b sfc_dt_atmos.tile5.nc
5cad2a009d8a4b1f5d2ce096e33a027f sfc_dt_atmos.tile6.nc
03f92921ec61bc2e8650bcc3b1cc3971 RESTART/fv_core.res.nc
c957529bea6d386bd759a76d22f2e7cd RESTART/fv_core.res.tile1.nc
0deec6f8605841075a24ba463727fe91 RESTART/fv_core.res.tile2.nc
8d73cd492d9a5e7df5bcd85cb4e6b9d2 RESTART/fv_core.res.tile3.nc
ce94b006d54f96bcf4a9ed76dc7245ef RESTART/fv_core.res.tile4.nc
45140085eca81ee22ebaa157ca1328b3 RESTART/fv_core.res.tile5.nc
45ad33425fa370fc9608c0dd02cea93b RESTART/fv_core.res.tile6.nc
ab053411881826b83c431452e8a21bae RESTART/fv_srf_wnd.res.tile1.nc
5f43ce20819d99c075f8099d17cb33a4 RESTART/fv_srf_wnd.res.tile2.nc
51367e0390b27302b65f07bb8cbc26be RESTART/fv_srf_wnd.res.tile3.nc
9b63100161b59d4481a011141bfe73fc RESTART/fv_srf_wnd.res.tile4.nc
a59b81db3d1dcff0cde9777d7e41f4c1 RESTART/fv_srf_wnd.res.tile5.nc
a1403fa6e17f525e84ed61ad3950610c RESTART/fv_srf_wnd.res.tile6.nc
ce72ffd592a4ec9354e96a98f98853c6 RESTART/fv_tracer.res.tile1.nc
cdb7054a7ba5f65817a8d32d9e798c34 RESTART/fv_tracer.res.tile2.nc
ff59ad750fc5bdb1a9eede9de11636e4 RESTART/fv_tracer.res.tile3.nc
aaee93d3e6faa6fc19927f6597d7948e RESTART/fv_tracer.res.tile4.nc
9dfb27cf18c74fdb004303397b7a04c5 RESTART/fv_tracer.res.tile5.nc
450a30a3e7ed5d05941da6575522505e RESTART/fv_tracer.res.tile6.nc
c7717e42f317fc3d655961e8b4fb61df RESTART/phy_data.tile1.nc
08e4ce9d401c004ad6e8a4b9b87c377c RESTART/phy_data.tile2.nc
e5bfbd4f781eeb71e2e068690197f9b9 RESTART/phy_data.tile3.nc
176985ed417bbce6711c270ff12adb26 RESTART/phy_data.tile4.nc
db22857ad4e13ed2ad2374566768325c RESTART/phy_data.tile5.nc
438a836fa84e26c446f3eba5708820e5 RESTART/phy_data.tile6.nc
b0802baead037efd30f6e37af0c56fa5 RESTART/sfc_data.tile1.nc
1dccb88d6974aa622a664598fa9c3525 RESTART/sfc_data.tile2.nc
994911b5950c004b1b728683641ec970 RESTART/sfc_data.tile3.nc
c6f8b3e20d4ab59cdef5345ea91df7ca RESTART/sfc_data.tile4.nc
f8fa244da4d9c3bdca68393c3cffe2f8 RESTART/sfc_data.tile5.nc
3bd2790192ec41faf5592e60d9ad4753 RESTART/sfc_data.tile6.nc
Loading

0 comments on commit 9961a82

Please sign in to comment.