Skip to content

Commit

Permalink
Merge pull request ECCO-GROUP#186 from ECCO-GROUP/Docker
Browse files Browse the repository at this point in the history
Moved Docker instructions for V4r4 in to ecco-v4-configurations
  • Loading branch information
ifenty authored Sep 24, 2023
2 parents 82b4c10 + 0945b95 commit 2adf0a9
Show file tree
Hide file tree
Showing 12 changed files with 744 additions and 0 deletions.
55 changes: 55 additions & 0 deletions ECCOv4 Release 4/Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM debian:latest

RUN ["/bin/bash", "-c", "echo I am using bash"]
SHELL ["/bin/bash", "-c"]

ARG CHIP_ARCT=x86_64

USER root

ENV mainpath ./
RUN echo ${mainpath}

RUN mkdir -p ${mainpath}


# install libraries as root user
USER root

RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential && \
apt-get install -y --no-install-recommends vim && \
apt-get install -y --no-install-recommends less && \
apt-get install -y --no-install-recommends git && \
apt-get install -y --no-install-recommends wget && \
apt-get install -y --no-install-recommends unzip && \
apt-get install -y --no-install-recommends ca-certificates && \
apt-get install -y --no-install-recommends gfortran && \
apt-get install -y --no-install-recommends gnuplot && \
apt-get install -y --no-install-recommends openmpi-bin && \
apt-get install -y --no-install-recommends openmpi-doc && \
apt-get install -y --no-install-recommends libopenmpi-dev && \
apt-get install -y --no-install-recommends mpich && \
apt-get install -y --no-install-recommends libnetcdf-dev && \
apt-get install -y --no-install-recommends libnetcdff-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN apt-get update
RUN update-ca-certificates

# add a user called 'ecco'
RUN useradd -ms /bin/bash ecco
USER ecco
ENV USER_HOME_DIR /home/ecco
WORKDIR /home/ecco

# copy local directory 'src' to the docker image /home/ecco/docker_src
COPY --chown=ecco:users ./src ${USER_HOME_DIR}/docker_src

# set environment variables for compiling MITgcm
ENV MPI_INC_DIR /usr/lib/${CHIP_ARCT}-linux-gnu/openmpi/include
ENV ROOTDIR /home/ecco/MITgcm

# download the mitgcm and ecco configuration files
RUN cd ${USER_HOME_DIR}
RUN ${USER_HOME_DIR}/docker_src/get_MITgcm_ECCO.sh
21 changes: 21 additions & 0 deletions ECCOv4 Release 4/Docker/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 gaelforget <[email protected]> and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
53 changes: 53 additions & 0 deletions ECCOv4 Release 4/Docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

This [Docker image configuration](https://www.docker.com) makes it easy to reproduce the [ECCO v4r4](https://ecco-group.org) state estimate.

It includes :

- gfortran, MPI, and NetCDF libraries needed to compile and run the MITgcm
- bash script to download the
1. [MITgcm](https://github.com/MITgcm/MITgcm) [checkpoint 66g](https://github.com/MITgcm/MITgcm/releases/tag/checkpoint66g)
2. [ECCOv4-py Configuration files](https://github.com/ECCO-GROUP/ECCO-v4-Configurations)

Future versions will include Jupyter hub and the [ECCOv4-py Python Library](https://github.com/ECCO-GROUP/ECCOv4-py).


## Directions

To use on your local computer

You will need [Docker Desktop](https://docs.docker.com/desktop/) installed.

To build your own image, go into the directory ECCO-Docker/ECCO_v4r4 and run

```
docker build -t ecco_v4r4_docker_image .
```

If your computer is a Mac that uses ARM-based chips (such as M1), use the following command to build the image:

```
docker build -t ecco_v4r4_docker_image . --build-arg="CHIP_ARCT=aarch64"
```

To run the image do

```
docker run -t -i --rm ecco_v4r4_docker_image bash
```

After running you will be in an interactive bash shell.

To compile the MITgcm code first need to define SIZE.h a model configuration file in the ```ECCOV4/release4/code``` directory that specifies the number of cpus on your machine. We included a few SIZE.h_NN files for different number of cpus (NN).

After you have a SIZE.h file then go to the ```/home/ecco/ECCOV4/release4/build``` directory and build the model code:

```
>$ROOTDIR/tools/genmake2 -mods=../code -of=~/docker_src/linux_amd64_gfortran -mpi
>make -j depend
>make -j
```

The result will be an executable ```mitgcmuv```.

To run the model you will need to link all the binary files as described in the
Instructions for reproducing ECCO Version 4 Release 4 [[https://doi.org/10.5281/zenodo.7789915](https://doi.org/10.5281/zenodo.7789915) document.
66 changes: 66 additions & 0 deletions ECCOv4 Release 4/Docker/src/SIZE.h_12
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
CBOP
C !ROUTINE: SIZE.h
C !INTERFACE:
C include SIZE.h
C !DESCRIPTION: \bv
C *==========================================================*
C | SIZE.h Declare size of underlying computational grid.
C *==========================================================*
C | The design here support a three-dimensional model grid
C | with indices I,J and K. The three-dimensional domain
C | is comprised of nPx*nSx blocks of size sNx along one axis
C | nPy*nSy blocks of size sNy along another axis and one
C | block of size Nz along the final axis.
C | Blocks have overlap regions of size OLx and OLy along the
C | dimensions that are subdivided.
C *==========================================================*
C \ev
CEOP
C Voodoo numbers controlling data layout.
C sNx :: No. X points in sub-grid.
C sNy :: No. Y points in sub-grid.
C OLx :: Overlap extent in X.
C OLy :: Overlat extent in Y.
C nSx :: No. sub-grids in X.
C nSy :: No. sub-grids in Y.
C nPx :: No. of processes to use in X.
C nPy :: No. of processes to use in Y.
C Nx :: No. points in X for the total domain.
C Ny :: No. points in Y for the total domain.
C Nr :: No. points in Z for full process domain.
INTEGER sNx
INTEGER sNy
INTEGER OLx
INTEGER OLy
INTEGER nSx
INTEGER nSy
INTEGER nPx
INTEGER nPy
INTEGER Nx
INTEGER Ny
INTEGER Nr
PARAMETER (
& sNx = 30,
& sNy = 30,
& OLx = 4,
& OLy = 4,
& nSx = 8,
& nSy = 1,
& nPx = 12,
& nPy = 1,
& Nx = sNx*nSx*nPx,
& Ny = sNy*nSy*nPy,
& Nr = 50 )

C MAX_OLX - Set to the maximum overlap region size of any array
C MAX_OLY that will be exchanged. Controls the sizing of exch
C routine buufers.
INTEGER MAX_OLX
INTEGER MAX_OLY
PARAMETER ( MAX_OLX = OLx,
& MAX_OLY = OLy )

integer nobcs
parameter ( nobcs = 4 )


66 changes: 66 additions & 0 deletions ECCOv4 Release 4/Docker/src/SIZE.h_13
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
CBOP
C !ROUTINE: SIZE.h
C !INTERFACE:
C include SIZE.h
C !DESCRIPTION: \bv
C *==========================================================*
C | SIZE.h Declare size of underlying computational grid.
C *==========================================================*
C | The design here support a three-dimensional model grid
C | with indices I,J and K. The three-dimensional domain
C | is comprised of nPx*nSx blocks of size sNx along one axis
C | nPy*nSy blocks of size sNy along another axis and one
C | block of size Nz along the final axis.
C | Blocks have overlap regions of size OLx and OLy along the
C | dimensions that are subdivided.
C *==========================================================*
C \ev
CEOP
C Voodoo numbers controlling data layout.
C sNx :: No. X points in sub-grid.
C sNy :: No. Y points in sub-grid.
C OLx :: Overlap extent in X.
C OLy :: Overlat extent in Y.
C nSx :: No. sub-grids in X.
C nSy :: No. sub-grids in Y.
C nPx :: No. of processes to use in X.
C nPy :: No. of processes to use in Y.
C Nx :: No. points in X for the total domain.
C Ny :: No. points in Y for the total domain.
C Nr :: No. points in Z for full process domain.
INTEGER sNx
INTEGER sNy
INTEGER OLx
INTEGER OLy
INTEGER nSx
INTEGER nSy
INTEGER nPx
INTEGER nPy
INTEGER Nx
INTEGER Ny
INTEGER Nr
PARAMETER (
& sNx = 90,
& sNy = 90,
& OLx = 4,
& OLy = 4,
& nSx = 1,
& nSy = 1,
& nPx = 13,
& nPy = 1,
& Nx = sNx*nSx*nPx,
& Ny = sNy*nSy*nPy,
& Nr = 50 )

C MAX_OLX - Set to the maximum overlap region size of any array
C MAX_OLY that will be exchanged. Controls the sizing of exch
C routine buufers.
INTEGER MAX_OLX
INTEGER MAX_OLY
PARAMETER ( MAX_OLX = OLx,
& MAX_OLY = OLy )

integer nobcs
parameter ( nobcs = 4 )


66 changes: 66 additions & 0 deletions ECCOv4 Release 4/Docker/src/SIZE.h_16
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
CBOP
C !ROUTINE: SIZE.h
C !INTERFACE:
C include SIZE.h
C !DESCRIPTION: \bv
C *==========================================================*
C | SIZE.h Declare size of underlying computational grid.
C *==========================================================*
C | The design here support a three-dimensional model grid
C | with indices I,J and K. The three-dimensional domain
C | is comprised of nPx*nSx blocks of size sNx along one axis
C | nPy*nSy blocks of size sNy along another axis and one
C | block of size Nz along the final axis.
C | Blocks have overlap regions of size OLx and OLy along the
C | dimensions that are subdivided.
C *==========================================================*
C \ev
CEOP
C Voodoo numbers controlling data layout.
C sNx :: No. X points in sub-grid.
C sNy :: No. Y points in sub-grid.
C OLx :: Overlap extent in X.
C OLy :: Overlat extent in Y.
C nSx :: No. sub-grids in X.
C nSy :: No. sub-grids in Y.
C nPx :: No. of processes to use in X.
C nPy :: No. of processes to use in Y.
C Nx :: No. points in X for the total domain.
C Ny :: No. points in Y for the total domain.
C Nr :: No. points in Z for full process domain.
INTEGER sNx
INTEGER sNy
INTEGER OLx
INTEGER OLy
INTEGER nSx
INTEGER nSy
INTEGER nPx
INTEGER nPy
INTEGER Nx
INTEGER Ny
INTEGER Nr
PARAMETER (
& sNx = 30,
& sNy = 30,
& OLx = 4,
& OLy = 4,
& nSx = 6,
& nSy = 1,
& nPx = 16,
& nPy = 1,
& Nx = sNx*nSx*nPx,
& Ny = sNy*nSy*nPy,
& Nr = 50 )

C MAX_OLX - Set to the maximum overlap region size of any array
C MAX_OLY that will be exchanged. Controls the sizing of exch
C routine buufers.
INTEGER MAX_OLX
INTEGER MAX_OLY
PARAMETER ( MAX_OLX = OLx,
& MAX_OLY = OLy )

integer nobcs
parameter ( nobcs = 4 )


66 changes: 66 additions & 0 deletions ECCOv4 Release 4/Docker/src/SIZE.h_24
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
CBOP
C !ROUTINE: SIZE.h
C !INTERFACE:
C include SIZE.h
C !DESCRIPTION: \bv
C *==========================================================*
C | SIZE.h Declare size of underlying computational grid.
C *==========================================================*
C | The design here support a three-dimensional model grid
C | with indices I,J and K. The three-dimensional domain
C | is comprised of nPx*nSx blocks of size sNx along one axis
C | nPy*nSy blocks of size sNy along another axis and one
C | block of size Nz along the final axis.
C | Blocks have overlap regions of size OLx and OLy along the
C | dimensions that are subdivided.
C *==========================================================*
C \ev
CEOP
C Voodoo numbers controlling data layout.
C sNx :: No. X points in sub-grid.
C sNy :: No. Y points in sub-grid.
C OLx :: Overlap extent in X.
C OLy :: Overlat extent in Y.
C nSx :: No. sub-grids in X.
C nSy :: No. sub-grids in Y.
C nPx :: No. of processes to use in X.
C nPy :: No. of processes to use in Y.
C Nx :: No. points in X for the total domain.
C Ny :: No. points in Y for the total domain.
C Nr :: No. points in Z for full process domain.
INTEGER sNx
INTEGER sNy
INTEGER OLx
INTEGER OLy
INTEGER nSx
INTEGER nSy
INTEGER nPx
INTEGER nPy
INTEGER Nx
INTEGER Ny
INTEGER Nr
PARAMETER (
& sNx = 30,
& sNy = 30,
& OLx = 4,
& OLy = 4,
& nSx = 4,
& nSy = 1,
& nPx = 24,
& nPy = 1,
& Nx = sNx*nSx*nPx,
& Ny = sNy*nSy*nPy,
& Nr = 50 )

C MAX_OLX - Set to the maximum overlap region size of any array
C MAX_OLY that will be exchanged. Controls the sizing of exch
C routine buufers.
INTEGER MAX_OLX
INTEGER MAX_OLY
PARAMETER ( MAX_OLX = OLx,
& MAX_OLY = OLy )

integer nobcs
parameter ( nobcs = 4 )


Loading

0 comments on commit 2adf0a9

Please sign in to comment.