From 0945b95b65f609edb748594a010d2a39f1224308 Mon Sep 17 00:00:00 2001 From: Ian Fenty Date: Sun, 24 Sep 2023 12:50:23 -0700 Subject: [PATCH] Moved Docker instructions for V4r4 in to ecco-v4-configurations Moved Docker instructions for V4r4 in to ecco-v4-configurations --- ECCOv4 Release 4/Docker/Dockerfile | 55 ++++++ ECCOv4 Release 4/Docker/LICENSE | 21 +++ ECCOv4 Release 4/Docker/README.md | 53 ++++++ ECCOv4 Release 4/Docker/src/SIZE.h_12 | 66 +++++++ ECCOv4 Release 4/Docker/src/SIZE.h_13 | 66 +++++++ ECCOv4 Release 4/Docker/src/SIZE.h_16 | 66 +++++++ ECCOv4 Release 4/Docker/src/SIZE.h_24 | 66 +++++++ ECCOv4 Release 4/Docker/src/SIZE.h_48 | 66 +++++++ ECCOv4 Release 4/Docker/src/SIZE.h_96 | 66 +++++++ .../Docker/src/build_MITgcm_ECCO.sh | 8 + .../Docker/src/get_MITgcm_ECCO.sh | 34 ++++ .../Docker/src/linux_amd64_gfortran | 177 ++++++++++++++++++ 12 files changed, 744 insertions(+) create mode 100644 ECCOv4 Release 4/Docker/Dockerfile create mode 100644 ECCOv4 Release 4/Docker/LICENSE create mode 100644 ECCOv4 Release 4/Docker/README.md create mode 100644 ECCOv4 Release 4/Docker/src/SIZE.h_12 create mode 100644 ECCOv4 Release 4/Docker/src/SIZE.h_13 create mode 100644 ECCOv4 Release 4/Docker/src/SIZE.h_16 create mode 100644 ECCOv4 Release 4/Docker/src/SIZE.h_24 create mode 100644 ECCOv4 Release 4/Docker/src/SIZE.h_48 create mode 100644 ECCOv4 Release 4/Docker/src/SIZE.h_96 create mode 100644 ECCOv4 Release 4/Docker/src/build_MITgcm_ECCO.sh create mode 100755 ECCOv4 Release 4/Docker/src/get_MITgcm_ECCO.sh create mode 100644 ECCOv4 Release 4/Docker/src/linux_amd64_gfortran diff --git a/ECCOv4 Release 4/Docker/Dockerfile b/ECCOv4 Release 4/Docker/Dockerfile new file mode 100644 index 0000000..1f18de4 --- /dev/null +++ b/ECCOv4 Release 4/Docker/Dockerfile @@ -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 diff --git a/ECCOv4 Release 4/Docker/LICENSE b/ECCOv4 Release 4/Docker/LICENSE new file mode 100644 index 0000000..5fe8a51 --- /dev/null +++ b/ECCOv4 Release 4/Docker/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 gaelforget 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. diff --git a/ECCOv4 Release 4/Docker/README.md b/ECCOv4 Release 4/Docker/README.md new file mode 100644 index 0000000..0a9c0b0 --- /dev/null +++ b/ECCOv4 Release 4/Docker/README.md @@ -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. diff --git a/ECCOv4 Release 4/Docker/src/SIZE.h_12 b/ECCOv4 Release 4/Docker/src/SIZE.h_12 new file mode 100644 index 0000000..b90f479 --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/SIZE.h_12 @@ -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 ) + + diff --git a/ECCOv4 Release 4/Docker/src/SIZE.h_13 b/ECCOv4 Release 4/Docker/src/SIZE.h_13 new file mode 100644 index 0000000..86fe0ef --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/SIZE.h_13 @@ -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 ) + + diff --git a/ECCOv4 Release 4/Docker/src/SIZE.h_16 b/ECCOv4 Release 4/Docker/src/SIZE.h_16 new file mode 100644 index 0000000..cc5cfbb --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/SIZE.h_16 @@ -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 ) + + diff --git a/ECCOv4 Release 4/Docker/src/SIZE.h_24 b/ECCOv4 Release 4/Docker/src/SIZE.h_24 new file mode 100644 index 0000000..be6a077 --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/SIZE.h_24 @@ -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 ) + + diff --git a/ECCOv4 Release 4/Docker/src/SIZE.h_48 b/ECCOv4 Release 4/Docker/src/SIZE.h_48 new file mode 100644 index 0000000..c4d0443 --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/SIZE.h_48 @@ -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 = 2, + & nSy = 1, + & nPx = 48, + & 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 ) + + diff --git a/ECCOv4 Release 4/Docker/src/SIZE.h_96 b/ECCOv4 Release 4/Docker/src/SIZE.h_96 new file mode 100644 index 0000000..8b3b9bc --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/SIZE.h_96 @@ -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 = 1, + & nSy = 1, + & nPx = 96, + & 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 ) + + diff --git a/ECCOv4 Release 4/Docker/src/build_MITgcm_ECCO.sh b/ECCOv4 Release 4/Docker/src/build_MITgcm_ECCO.sh new file mode 100644 index 0000000..ba38e79 --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/build_MITgcm_ECCO.sh @@ -0,0 +1,8 @@ +cd $USER_HOME_DIR/ECCOV4/release4 +mkdir build +cd build + +$ROOTDIR/tools/genmake2 -mods=../code optfile=$USER_HOME_DIR/docker_src/linux_amd64_gfortran + +make -j depend +make -j diff --git a/ECCOv4 Release 4/Docker/src/get_MITgcm_ECCO.sh b/ECCOv4 Release 4/Docker/src/get_MITgcm_ECCO.sh new file mode 100755 index 0000000..ff1a578 --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/get_MITgcm_ECCO.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +## Clone ECCO config files +cd $USER_HOME_DIR +git clone --depth 1 https://github.com/ECCO-GROUP/ECCO-v4-Configurations.git + +## checkout the MITgcm +git clone --depth 1 https://github.com/MITgcm/MITgcm.git -b checkpoint66g + +## Copy V4r4 config files to build directory +mkdir -p $USER_HOME_DIR/ECCOV4/release4 +cp -r "ECCO-v4-Configurations/ECCOv4 Release 4/code/" $USER_HOME_DIR/ECCOV4/release4/code +cp -r "ECCO-v4-Configurations/ECCOv4 Release 4/namelist/" $USER_HOME_DIR/ECCOV4/release4/namelist + +#cp ${USER_HOME_DIR}/docker_src/SIZE* $USER_HOME_DIR/ECCOV4/release/code + +## build the model + +cd $USER_HOME_DIR/ECCOV4/release4/code +mv SIZE.h SIZE.h_96 + +cp ${USER_HOME_DIR}/docker_src/SIZE* . + +cd $USER_HOME_DIR/ECCOV4/release4 +mkdir build +cd build + +echo "Choose or create a SIZE.h file before compiling" + +#$ROOTDIR/tools/genmake2 -mods=../code optfile=$USER_HOME_DIR/docker_src/linux_amd64_gfortran + +#make -j depend +#make -j + diff --git a/ECCOv4 Release 4/Docker/src/linux_amd64_gfortran b/ECCOv4 Release 4/Docker/src/linux_amd64_gfortran new file mode 100644 index 0000000..58d44cd --- /dev/null +++ b/ECCOv4 Release 4/Docker/src/linux_amd64_gfortran @@ -0,0 +1,177 @@ +#!/bin/bash + +# Build options for gfortran compiler (GNU) on Linux AMD64 platform +# +# Tested with gcc-gfortran v4.1.x as shipped with Fedora Core 6,7,8 +# up to gcc-gfortran v10.2.1 as shipped with Fedora Core 33 +# +# OpenMP : Tested with gcc-gfortran v4.3.2 with FC 10 (on dickens) +# with gcc-gfortran v4.4.5 with FC 13 (on baudelaire) +# with gcc-gfortran v7.5.0 with Ubuntu 18 LTS (on villon) +# up to gcc-gfortran v10.2.1 with FC 33 (on batsi) +# +# MPI : Tested on engaging, using: +# module load gcc (Version 4.8.4) +# module add mvapich2/gcc/64/2.0b +# and on baudelaire.csail.mit.edu (FC13), using: +# export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3 +# export MPI_INC_DIR=$MPI_GCC_DIR/include +# export PATH=$MPI_GCC_DIR/bin:$PATH +# and with openmpi, on several platforms (e.g, with Ubuntu) + +#------- +# run with OpenMP: needs to set environment var. OMP_NUM_THREADS +# and generally, needs to increase the thread stack-size: +# - sh,bash: +# > export OMP_NUM_THREADS=2 +# > export GOMP_STACKSIZE=400m +# - csh,tcsh: +# > setenv OMP_NUM_THREADS 2 +# > setenv GOMP_STACKSIZE 400m +#------- + +if test "x$MPI" = xtrue ; then + CC=${CC:=mpicc} + FC=${FC:=mpif77} + F90C=${F90C:=mpif90} +else + CC=gcc + FC=gfortran + F90C=gfortran +fi + +DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR' +EXTENDED_SRC_FLAG='-ffixed-line-length-132' +F90FIXEDFORMAT='-ffixed-form' +GET_FC_VERSION="--version" +OMPFLAG='-fopenmp' + +NOOPTFLAGS='-O0' +NOOPTFILES='' + +CFLAGS='-O0' + +#- for setting specific options, check compiler version: +fcVers=`$CC -dumpversion | head -n 1 | sed 's/^[^0-9]* //;s/\..*$//'` +if ! [[ $fcVers =~ ^[0-9]+$ ]] ; then + echo " un-recognized Compiler-version '$fcVers' ; ignored (-> set to 0)" ; fcVers=0 ; +else echo " get Compiler-version: '$fcVers'" ; fi + +if [ $fcVers -ge 10 ] ; then + FFLAGS="$FFLAGS -fallow-argument-mismatch" +fi +#- Requires gfortran from 2006 onwards for -fconvert=big-endian +FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none" +#- for big setups, compile & link with "-fPIC" or set memory-model to "medium": +#CFLAGS="$CFLAGS -fPIC" +#FFLAGS="$FFLAGS -fPIC" +#- with FC 19, need to use this without -fPIC (which cancels -mcmodel option): + CFLAGS="$CFLAGS -mcmodel=medium" + FFLAGS="$FFLAGS -mcmodel=medium" +#- might want to use '-fdefault-real-8' for fizhi pkg: +#FFLAGS="$FFLAGS -fdefault-real-8 -fdefault-double-8" + +if test "x$IEEE" = x ; then #- with optimisation: + #- full optimisation + FOPTIM='-O3 -funroll-loops' + NOOPTFILES="$NOOPTFILES ini_masks_etc.F" + #- can use -O2 (safe optimisation) to avoid Pb with some gcc version of -O3: + #FOPTIM='-O2 -funroll-loops' +else + # these may also be useful, but require specific gfortran versions: + # -Wnonstd-intrinsics for gfortran <= 4.3 + # -Wintrinsics-std for gfortran >= 4.4 + # -Wno-tabs for gfortran >= 4.3 + # -Wno-unused-dummy-argument for gfortran >= 4.6 + #FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation" + #- or simply: + FFLAGS="$FFLAGS -Wall" + if [ $fcVers -ge 10 ] ; then + FFLAGS="$FFLAGS -Wno-unused-dummy-argument" + fi + #- to get plenty of warnings: -Wall -Wextra (older form: -Wall -W) or: + #FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels" + if test "x$DEVEL" = x ; then #- no optimisation + IEEE : + FOPTIM='-O0' + else #- development/check options: + FOPTIM='-O0 -g -fbounds-check' + FOPTIM="$FOPTIM -ffpe-trap=invalid,zero,overflow -finit-real=inf" + fi +fi + +F90FLAGS=$FFLAGS +F90OPTIM=$FOPTIM + +INCLUDEDIRS='' +INCLUDES='' +LIBS='' + +if [ "x$NETCDF_ROOT" != x ] ; then + INCLUDEDIR="${NETCDF_ROOT}/include" + INCLUDES="-I${NETCDF_ROOT}/include" + LIBDIR="${NETCDF_ROOT}/lib" + LIBS="-L${NETCDF_ROOT}/lib" +elif [ "x$NETCDF_HOME" != x ]; then + INCLUDEDIR="${NETCDF_HOME}/include" + INCLUDES="-I${NETCDF_HOME}/include" + LIBDIR="${NETCDF_HOME}/lib" + LIBS="-L${NETCDF_HOME}/lib" +elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then + NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` + NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` + INCLUDEDIR="${NETCDF_INC}" + INCLUDES="-I${NETCDF_INC}" + LIBDIR="${NETCDF_LIB}" + LIBS="-L${NETCDF_LIB}" +elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then + INCLUDEDIR="${NETCDF_INCDIR}" + INCLUDES="-I${NETCDF_INCDIR}" + LIBDIR="${NETCDF_LIBDIR}" + LIBS="-L${NETCDF_LIBDIR}" +elif [[ -n $( nf-config --includedir 2> /dev/null ) && ($? == 0) ]] ; then + # NETCDF env variables are not set, trying nf-config instead + INCLUDEDIR=$( nf-config --includedir ) + INCLUDES="-I$INCLUDEDIR" + LIBS=$( nf-config --flibs ) +elif test -d /usr/include/netcdf-3 ; then + INCLUDES='-I/usr/include/netcdf-3' + LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3' +elif test -d /usr/include/netcdf ; then + INCLUDES='-I/usr/include/netcdf' +elif test -d /usr/local/netcdf ; then + INCLUDES='-I/usr/local/netcdf/include' + LIBS='-L/usr/local/netcdf/lib' +elif test -d /usr/local/include/netcdf.inc ; then + INCLUDES='-I/usr/local/include' + LIBS='-L/usr/local/lib64' +elif test -d /usr/include/netcdf.inc ; then + INCLUDES='-I/usr/include' + LIBS='-L/usr/lib64' +fi + +if [ -n "$MPI_HOME" -a -z "$MPI_INC_DIR" ]; then + MPI_INC_DIR="$MPI_HOME/include" +fi + +if [ "x$MPI" = xtrue ] ; then + if [ -z "$MPI_INC_DIR" ] ; then + # MPI env variables are not set, trying pkg-config insteal + if [[ -n $( pkg-config --cflags-only-I ompi ) && ($? == 0) ]] ; then + MPI_INC_DIR=$(pkg-config --cflags-only-I ompi | awk '{ print $1 }' | sed -e "s/-I//" ) + else + echo MPI_HOME is not set and pkg-config not available, aborting + exit 1 + fi + fi + if [ -n "$MPI_INC_DIR" ] ; then + # only fill this if we can find MPI, otherwise triggers netcdf error + INCLUDES+=" -I$MPI_INC_DIR" + INCLUDEDIRS+=" $MPI_INC_DIR" + #- used for parallel (MPI) DIVA + MPIINCLUDEDIR="$MPI_INC_DIR" + else + echo could not set MPI_INC_DIR, aborting + exit 1 + fi +fi +