The NWP models have a fairly complex dependent application stack. To use GSI, a massively parallel computational data assimilation code, as an example, we have a large dependency on a message passing interface (MPI) implementation (e.g. OpenMPI), and NetCDF. NetCDF has a dependency on HDF5, HDF5 on zlib, etc. All of these need a C/C++/fortran compiler for building. Figuring out and understanding these dependencies and learning to debug build issues can take a really long time for a scientist to master. 

Docker allows for the ability to run applications in prebuilt containers on any Linux machine with Docker installed (or even Mac OS X and Windows via Boot2Docker).

Purpose

This is for code development purposes only , not for production run. 

  • Install Docker on your computer

please refer to https://www.docker.com/community-edition for Docker installation on Linux, Mac and Windows.

Docker Installation

Docker works perfectly on Linux and Mac, I have tried Docker on Windows, but still have some issues.

Check if the docker is installed

check docker installation
[xinzhang@mdf-rtr-9 ~]$ docker version
Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:05:44 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 17:05:44 2017
 OS/Arch:      linux/amd64
 Experimental: false
list all images
[xinzhang@mdf-rtr-9 ~]$ docker images


I already built three Docker images with gnu compiler v5.4, v6.2 and v7.1 respectively, which include most necessary libraries and tools ( Jasper, JPEG, PNG, ZLIB SZIP, NetCDF, HDF5, PNETCDF, UDUNITS2, XERCES, NCO, CDO , GRIB-API, ESMF, MPI) to build NWP models and softwares.

To pull/checkout the default docker image (gnu compiler v5.4) :

pull the default docker image
[xinzhang@mdf-rtr-9 ~]$ docker pull xinzhang8noaa/common_libs
Using default tag: latest
latest: Pulling from xinzhang8noaa/common_libs
bd97b43c27e3: Already exists 
6960dc1aba18: Already exists 
2b61829b0db5: Already exists 
1f88dc826b14: Already exists 
73b3859b1e43: Already exists 
c294df930c56: Pull complete 
c975eeee8eb6: Pull complete 
1395f791a807: Pull complete 
a73c66160c97: Pull complete 
4abaf3b2d76e: Pull complete 
Digest: sha256:704838ae42fb1eb852f25fd43db2dd550dd06f186ceb7a4113028a373bc2bdaf
Status: Downloaded newer image for xinzhang8noaa/common_libs:latest


[xinzhang@mdf-rtr-9 ~]$ docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
xinzhang8noaa/common_libs   latest              6bf0a048145e        23 hours ago        766 MB

To pull/checkout the docker images with gnu compiler v6.2 and v7.1

pull docker images gnu6.2 or gnu7.1
[xinzhang@mdf-rtr-9 ~]$ docker pull xinzhang8noaa/common_libs:gnu6.2
gnu6.2: Pulling from xinzhang8noaa/common_libs
bd97b43c27e3: Already exists 
6960dc1aba18: Already exists 
2b61829b0db5: Already exists 
1f88dc826b14: Already exists 
73b3859b1e43: Already exists 
b75c3b94a1cf: Pull complete 
141017c22703: Pull complete 
d44b3ff99d83: Pull complete 
a2c8fcbc7788: Pull complete 
754b053765e8: Pull complete 
Digest: sha256:9ee55a00b965a1aca1b99d64ec5f5fc54c9a6e914e9bbd61c1173dbad0be93d5
Status: Downloaded newer image for xinzhang8noaa/common_libs:gnu6.2

[xinzhang@mdf-rtr-9 ~]$ docker pull xinzhang8noaa/common_libs:gnu7.1
gnu7.1: Pulling from xinzhang8noaa/common_libs
bd97b43c27e3: Already exists 
6960dc1aba18: Already exists 
2b61829b0db5: Already exists 
1f88dc826b14: Already exists 
73b3859b1e43: Already exists 
55d564d09a2f: Pull complete 
89ed4fa37517: Pull complete 
11e7d0a132fd: Pull complete 
0a489fc7cafb: Pull complete 
ba4c1b1b5d62: Pull complete 
Digest: sha256:e272f1aa43fb284e29e1ebdf0dd382b3764c8cbfecc11939e4bf7976df0c9c67
Status: Downloaded newer image for xinzhang8noaa/common_libs:gnu7.1

[xinzhang@mdf-rtr-9 ~]$ docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
xinzhang8noaa/common_libs   latest              6bf0a048145e        24 hours ago        766 MB
xinzhang8noaa/common_libs   gnu6.2              741d56075f12        2 days ago          2.39 GB
xinzhang8noaa/common_libs   gnu7.1              94b51b858306        2 days ago          1.94 GB
  • Checkout the GSI code from Bitbucket

Please follow the below steps to check out the GSI branch for gnu compiler

check out GSI gnu branch
[xinzhang@mdf-rtr-9 tmp]$ git clone git@bitbucket.org:jcsda/gsi.git
Cloning into 'gsi'...
remote: Counting objects: 43561, done.
remote: Compressing objects: 100% (15761/15761), done.
remote: Total 43561 (delta 27452), reused 43216 (delta 27145)
Receiving objects: 100% (43561/43561), 935.00 MiB | 11.42 MiB/s, done.
Resolving deltas: 100% (27452/27452), done.


[xinzhang@mdf-rtr-9 tmp]$ cd gsi/

[xinzhang@mdf-rtr-9 gsi]$ git submodule init
Submodule 'fix' (git@bitbucket.org:jcsda/fix) registered for path 'fix'
Submodule 'libsrc' (git@bitbucket.org:jcsda/external-libs) registered for path 'libsrc'

[xinzhang@mdf-rtr-9 gsi]$ git submodule update
Cloning into 'fix'...
remote: Counting objects: 332, done.
remote: Compressing objects: 100% (235/235), done.
remote: Total 332 (delta 102), reused 320 (delta 96)
Receiving objects: 100% (332/332), 961.58 MiB | 20.47 MiB/s, done.
Resolving deltas: 100% (102/102), done.
Submodule path 'fix': checked out 'd13e5a23dde538ceefedc39746b029878ee6ff60'
Cloning into 'libsrc'...
remote: Counting objects: 892, done.
remote: Compressing objects: 100% (626/626), done.
remote: Total 892 (delta 260), reused 892 (delta 260)
Receiving objects: 100% (892/892), 5.54 MiB | 0 bytes/s, done.
Resolving deltas: 100% (260/260), done.
Submodule path 'libsrc': checked out '8fa69e1fd011b658de6cd2e9f08cf1ad77566f4f'

[xinzhang@mdf-rtr-9 gsi]$ git fetch && git checkout gnu_pgi_port
Branch gnu_pgi_port set up to track remote branch gnu_pgi_port from origin.
Switched to a new branch 'gnu_pgi_port'


  • Building and running GSI in Docker image

Suppose you have a GSI directory, which includes the GSI codes, we are going to start the docker and mount the GSI directory into the container.

Use docker images with gnu compiler v6.2 as example:

run docker
[xinzhang@mdf-rtr-9 gsi]$ pwd
/home/xinzhang/jedi/gsi

[xinzhang@mdf-rtr-9 tmp]$ id
uid=1000(xinzhang) gid=1001(xinzhang) groups=1001(xinzhang),1000(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[xinzhang@mdf-rtr-9 gsi]$ docker run -it --rm --name GSI --user 1000:1001 -v /home/xinzhang/jedi/gsi:/gsi -w /gsi xinzhang8noaa/common_libs:gnu6.2
groups: cannot find name for group ID 1001
I have no name!@27fe216a4aed:/gsi$ ls -la
total 84
drwxrwxr-x. 13 1000 1001   243 Jun 19 17:16 .
drwxr-xr-x.  1 root root    57 Jun 19 17:33 ..
drwxrwxr-x.  9 1000 1001   196 Jun 19 17:16 .git
-rw-rw-r--.  1 1000 1001   104 Jun 19 17:12 .gitmodules
-rw-rw-r--.  1 1000 1001  7566 Jun 19 17:12 CMakeLists.txt
-rw-rw-r--.  1 1000 1001  7124 Jun 19 17:12 README.cmake
-rw-rw-r--.  1 1000 1001  1470 Jun 19 17:16 bitbucket-pipelines.yml
drwxrwxr-x.  3 1000 1001    21 Jun 19 17:12 cmake
drwxrwxr-x. 12 1000 1001   167 Jun 19 17:12 core-libs
drwxrwxr-x.  4 1000 1001    51 Jun 19 17:12 doc
drwxrwxr-x.  4 1000 1001 12288 Jun 19 17:15 fix
drwxrwxr-x.  3 1000 1001    17 Jun 19 17:12 lib
drwxrwxr-x. 11 1000 1001   160 Jun 19 17:15 libsrc
drwxrwxr-x.  3 1000 1001  4096 Jun 19 17:12 scripts
drwxrwxr-x.  3 1000 1001 20480 Jun 19 17:16 src
drwxrwxr-x.  4 1000 1001   161 Jun 19 17:12 unit-tests
drwxrwxr-x. 24 1000 1001  4096 Jun 19 17:12 util


I have no name!@27fe216a4aed:/gsi$ mpifort -v      
Using built-in specs.
COLLECT_GCC=/usr/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/usr
Thread model: posix
gcc version 6.2.0 (GCC) 

I have no name!@27fe216a4aed:/gsi$ mpifort -showme
gfortran -I/usr/local/include -pthread -I/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -Wl,--enable-new-dtags -L/usr/local/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi

I have no name!@27fe216a4aed:/gsi$ ls -al /usr/local/lib/
total 201932
drwxr-xr-x.  6 root root     8192 Jun 17 06:10 .
drwxr-xr-x. 12 root root      136 Jun 17 06:10 ..
drwxr-xr-x.  4 root root       40 Jun 17 06:04 cmake
-rw-r--r--.  1 root root     5371 Jun 17 06:10 esmf.mk
lrwxrwxrwx.  1 root root       12 Jun 17 06:01 libblas.so -> libblas.so.3
lrwxrwxrwx.  1 root root       16 Jun 17 06:01 libblas.so.3 -> libblas.so.3.7.0
-rw-r--r--.  1 root root   360392 Jun 17 05:59 libblas.so.3.7.0
-rw-r--r--.  1 root root 80456684 Jun 17 06:10 libesmf.a
-rwxr-xr-x.  1 root root 20399568 Jun 17 06:10 libesmf.so
-rwxr-xr-x.  1 root root 21956400 Jun 17 06:10 libesmf_fullylinked.so
-rw-r--r--.  1 root root   962740 Jun 17 06:10 libfreetype.a
-rw-r--r--.  1 root root  1773048 Jun 17 06:05 libgrib_api.so
-rw-r--r--.  1 root root   120328 Jun 17 06:05 libgrib_api_f77.so
-rw-r--r--.  1 root root   154424 Jun 17 06:05 libgrib_api_f90.so
-rw-r--r--.  1 root root  6896232 Jun 17 06:10 libhdf5.a
-rwxr-xr-x.  1 root root      956 Jun 17 06:03 libhdf5.la
-rw-r--r--.  1 root root     2837 Jun 17 06:03 libhdf5.settings
lrwxrwxrwx.  1 root root       17 Jun 17 06:03 libhdf5.so -> libhdf5.so.10.2.0
lrwxrwxrwx.  1 root root       17 Jun 17 06:03 libhdf5.so.10 -> libhdf5.so.10.2.0
-rwxr-xr-x.  1 root root  3314752 Jun 17 06:03 libhdf5.so.10.2.0
-rw-r--r--.  1 root root   891156 Jun 17 06:10 libhdf5_cpp.a
-rwxr-xr-x.  1 root root     1037 Jun 17 06:03 libhdf5_cpp.la
lrwxrwxrwx.  1 root root       21 Jun 17 06:03 libhdf5_cpp.so -> libhdf5_cpp.so.12.0.0
lrwxrwxrwx.  1 root root       21 Jun 17 06:03 libhdf5_cpp.so.12 -> libhdf5_cpp.so.12.0.0
-rwxr-xr-x.  1 root root   528248 Jun 17 06:03 libhdf5_cpp.so.12.0.0
-rw-r--r--.  1 root root   445112 Jun 17 06:10 libhdf5_fortran.a
-rwxr-xr-x.  1 root root     1133 Jun 17 06:03 libhdf5_fortran.la
lrwxrwxrwx.  1 root root       25 Jun 17 06:03 libhdf5_fortran.so -> libhdf5_fortran.so.10.0.3
lrwxrwxrwx.  1 root root       25 Jun 17 06:03 libhdf5_fortran.so.10 -> libhdf5_fortran.so.10.0.3
-rwxr-xr-x.  1 root root   367960 Jun 17 06:03 libhdf5_fortran.so.10.0.3
-rw-r--r--.  1 root root   211428 Jun 17 06:10 libhdf5_hl.a
-rwxr-xr-x.  1 root root     1003 Jun 17 06:03 libhdf5_hl.la
lrwxrwxrwx.  1 root root       20 Jun 17 06:03 libhdf5_hl.so -> libhdf5_hl.so.10.1.0
lrwxrwxrwx.  1 root root       20 Jun 17 06:03 libhdf5_hl.so.10 -> libhdf5_hl.so.10.1.0
-rwxr-xr-x.  1 root root   149408 Jun 17 06:03 libhdf5_hl.so.10.1.0
-rw-r--r--.  1 root root    16024 Jun 17 06:10 libhdf5_hl_cpp.a
-rwxr-xr-x.  1 root root     1117 Jun 17 06:03 libhdf5_hl_cpp.la
lrwxrwxrwx.  1 root root       24 Jun 17 06:03 libhdf5_hl_cpp.so -> libhdf5_hl_cpp.so.11.1.0
lrwxrwxrwx.  1 root root       24 Jun 17 06:03 libhdf5_hl_cpp.so.11 -> libhdf5_hl_cpp.so.11.1.0
-rwxr-xr-x.  1 root root    20736 Jun 17 06:03 libhdf5_hl_cpp.so.11.1.0
-rw-r--r--.  1 root root   127736 Jun 17 06:10 libhdf5hl_fortran.a
-rwxr-xr-x.  1 root root     1210 Jun 17 06:03 libhdf5hl_fortran.la
lrwxrwxrwx.  1 root root       27 Jun 17 06:03 libhdf5hl_fortran.so -> libhdf5hl_fortran.so.10.0.3
lrwxrwxrwx.  1 root root       27 Jun 17 06:03 libhdf5hl_fortran.so.10 -> libhdf5hl_fortran.so.10.0.3
-rwxr-xr-x.  1 root root   116080 Jun 17 06:03 libhdf5hl_fortran.so.10.0.3
-rw-r--r--.  1 root root   641292 Jun 17 06:10 libjasper.a
-rwxr-xr-x.  1 root root      961 Jun 17 05:59 libjasper.la
lrwxrwxrwx.  1 root root       18 Jun 17 05:59 libjasper.so -> libjasper.so.1.0.0
lrwxrwxrwx.  1 root root       18 Jun 17 05:59 libjasper.so.1 -> libjasper.so.1.0.0
-rwxr-xr-x.  1 root root   483192 Jun 17 05:59 libjasper.so.1.0.0
-rw-r--r--.  1 root root   431748 Jun 17 06:10 libjpeg.a
-rwxr-xr-x.  1 root root      917 Jun 17 05:59 libjpeg.la
lrwxrwxrwx.  1 root root       16 Jun 17 05:59 libjpeg.so -> libjpeg.so.9.2.0
lrwxrwxrwx.  1 root root       16 Jun 17 05:59 libjpeg.so.9 -> libjpeg.so.9.2.0
-rwxr-xr-x.  1 root root   355576 Jun 17 05:59 libjpeg.so.9.2.0
lrwxrwxrwx.  1 root root       14 Jun 17 06:01 liblapack.so -> liblapack.so.3
lrwxrwxrwx.  1 root root       18 Jun 17 06:01 liblapack.so.3 -> liblapack.so.3.7.0
-rw-r--r--.  1 root root  6902440 Jun 17 06:00 liblapack.so.3.7.0
-rwxr-xr-x.  5 root root      992 Jun 17 05:57 libmca_common_sm.la
lrwxrwxrwx.  1 root root       27 Jun 17 05:57 libmca_common_sm.so -> libmca_common_sm.so.20.10.0
lrwxrwxrwx.  1 root root       27 Jun 17 05:57 libmca_common_sm.so.20 -> libmca_common_sm.so.20.10.0
-rwxr-xr-x.  5 root root    12920 Jun 17 05:57 libmca_common_sm.so.20.10.0
-rwxr-xr-x.  5 root root      997 Jun 17 05:57 libmpi.la
lrwxrwxrwx.  1 root root       17 Jun 17 05:57 libmpi.so -> libmpi.so.20.10.0
lrwxrwxrwx.  1 root root       17 Jun 17 05:57 libmpi.so.20 -> libmpi.so.20.10.0
-rwxr-xr-x.  5 root root  1193128 Jun 17 05:57 libmpi.so.20.10.0
-rwxr-xr-x.  5 root root     1073 Jun 17 05:57 libmpi_cxx.la
lrwxrwxrwx.  1 root root       21 Jun 17 05:57 libmpi_cxx.so -> libmpi_cxx.so.20.10.0
lrwxrwxrwx.  1 root root       21 Jun 17 05:57 libmpi_cxx.so.20 -> libmpi_cxx.so.20.10.0
-rwxr-xr-x.  5 root root   140560 Jun 17 05:57 libmpi_cxx.so.20.10.0
-rwxr-xr-x.  5 root root     1157 Jun 17 05:57 libmpi_mpifh.la
lrwxrwxrwx.  1 root root       23 Jun 17 05:57 libmpi_mpifh.so -> libmpi_mpifh.so.20.10.0
lrwxrwxrwx.  1 root root       23 Jun 17 05:57 libmpi_mpifh.so.20 -> libmpi_mpifh.so.20.10.0
-rwxr-xr-x.  5 root root   557160 Jun 17 05:57 libmpi_mpifh.so.20.10.0
-rwxr-xr-x.  5 root root     1170 Jun 17 05:57 libmpi_usempi_ignore_tkr.la
lrwxrwxrwx.  1 root root       35 Jun 17 05:57 libmpi_usempi_ignore_tkr.so -> libmpi_usempi_ignore_tkr.so.20.10.0
lrwxrwxrwx.  1 root root       35 Jun 17 05:57 libmpi_usempi_ignore_tkr.so.20 -> libmpi_usempi_ignore_tkr.so.20.10.0
-rwxr-xr-x.  5 root root    32600 Jun 17 05:57 libmpi_usempi_ignore_tkr.so.20.10.0
-rwxr-xr-x.  5 root root     1208 Jun 17 05:57 libmpi_usempif08.la
lrwxrwxrwx.  1 root root       27 Jun 17 05:57 libmpi_usempif08.so -> libmpi_usempif08.so.20.10.0
lrwxrwxrwx.  1 root root       27 Jun 17 05:57 libmpi_usempif08.so.20 -> libmpi_usempif08.so.20.10.0
-rwxr-xr-x.  5 root root   272192 Jun 17 05:57 libmpi_usempif08.so.20.10.0
-rw-r--r--.  1 root root      771 Jun 17 06:03 libnetcdf.settings
lrwxrwxrwx.  1 root root       15 Jun 17 06:04 libnetcdf.so -> libnetcdf.so.11
lrwxrwxrwx.  1 root root       19 Jun 17 06:04 libnetcdf.so.11 -> libnetcdf.so.11.4.0
-rw-r--r--.  1 root root  1611296 Jun 17 06:03 libnetcdf.so.11.4.0
-rw-r--r--.  1 root root   936354 Jun 17 06:10 libnetcdff.a
-rwxr-xr-x.  1 root root      971 Jun 17 06:04 libnetcdff.la
lrwxrwxrwx.  1 root root       19 Jun 17 06:04 libnetcdff.so -> libnetcdff.so.6.1.1
lrwxrwxrwx.  1 root root       19 Jun 17 06:04 libnetcdff.so.6 -> libnetcdff.so.6.1.1
-rwxr-xr-x.  1 root root   771656 Jun 17 06:04 libnetcdff.so.6.1.1
-rwxr-xr-x.  5 root root      968 Jun 17 05:57 libompitrace.la
lrwxrwxrwx.  1 root root       23 Jun 17 05:57 libompitrace.so -> libompitrace.so.20.10.0
lrwxrwxrwx.  1 root root       23 Jun 17 05:57 libompitrace.so.20 -> libompitrace.so.20.10.0
-rwxr-xr-x.  5 root root    19240 Jun 17 05:57 libompitrace.so.20.10.0
-rwxr-xr-x.  5 root root      967 Jun 17 05:57 libopen-pal.la
lrwxrwxrwx.  1 root root       22 Jun 17 05:57 libopen-pal.so -> libopen-pal.so.20.10.0
lrwxrwxrwx.  1 root root       22 Jun 17 05:57 libopen-pal.so.20 -> libopen-pal.so.20.10.0
-rwxr-xr-x.  5 root root  1417392 Jun 17 05:57 libopen-pal.so.20.10.0
-rwxr-xr-x.  5 root root      997 Jun 17 05:57 libopen-rte.la
lrwxrwxrwx.  1 root root       22 Jun 17 05:57 libopen-rte.so -> libopen-rte.so.20.10.0
lrwxrwxrwx.  1 root root       22 Jun 17 05:57 libopen-rte.so.20 -> libopen-rte.so.20.10.0
-rwxr-xr-x.  5 root root   587992 Jun 17 05:57 libopen-rte.so.20.10.0
-rwxr-xr-x.  5 root root     1040 Jun 17 05:57 liboshmem.la
lrwxrwxrwx.  1 root root       20 Jun 17 05:57 liboshmem.so -> liboshmem.so.20.10.0
lrwxrwxrwx.  1 root root       20 Jun 17 05:57 liboshmem.so.20 -> liboshmem.so.20.10.0
-rwxr-xr-x.  5 root root   639184 Jun 17 05:57 liboshmem.so.20.10.0
-rw-r--r--.  1 root root 11421980 Jun 17 06:10 libpnetcdf.a
-rw-r--r--.  1 root root 11421980 Jun 17 05:59 libpnetcdf.so
drwxr-xr-x.  2 root root       58 Jun 17 05:59 libpng
lrwxrwxrwx.  1 root root       10 Jun 17 05:59 libpng.a -> libpng14.a
lrwxrwxrwx.  1 root root       11 Jun 17 05:59 libpng.so -> libpng14.so
-rw-r--r--.  1 root root   275508 Jun 17 06:10 libpng14.a
lrwxrwxrwx.  1 root root       14 Jun 17 05:59 libpng14.so -> libpng14.so.14
lrwxrwxrwx.  1 root root       19 Jun 17 05:59 libpng14.so.14 -> libpng14.so.14.19.0
-rw-r--r--.  1 root root   213624 Jun 17 05:59 libpng14.so.14.19.0
-rw-r--r--.  1 root root    71082 Jun 17 06:10 libsz.a
-rw-r--r--.  1 root root    60776 Jun 17 05:59 libsz.so
-rw-r--r--.  1 root root    71082 Jun 17 06:10 libszip.a
lrwxrwxrwx.  1 root root       14 Jun 17 05:59 libszip.so -> libszip.so.2.1
-rw-r--r--.  1 root root    60776 Jun 17 05:59 libszip.so.2.1
-rw-r--r--.  1 root root   411744 Jun 17 06:00 libtmglib.so
-rw-r--r--.  1 root root   145944 Jun 17 05:59 libudunits2.so
-rwxr-xr-x.  1 root root  6551168 Jun 17 06:02 libxerces-c-3.1.so
-rw-r--r--.  1 root root 18924714 Jun 17 06:10 libxerces-c.a
-rwxr-xr-x.  1 root root     1040 Jun 17 06:02 libxerces-c.la
lrwxrwxrwx.  1 root root       18 Jun 17 06:02 libxerces-c.so -> libxerces-c-3.1.so
-rw-r--r--.  1 root root   145594 Jun 17 06:10 libz.a
lrwxrwxrwx.  1 root root        9 Jun 17 05:59 libz.so -> libz.so.1
lrwxrwxrwx.  1 root root       14 Jun 17 05:59 libz.so.1 -> libz.so.1.2.11
-rw-r--r--.  1 root root   118424 Jun 17 05:59 libz.so.1.2.11
-rwxr-xr-x.  5 root root    83524 Jun 17 05:57 mpi.mod
-rwxr-xr-x.  5 root root      247 Jun 17 05:57 mpi_ext.mod
-rwxr-xr-x.  5 root root   155091 Jun 17 05:57 mpi_f08.mod
-rwxr-xr-x.  5 root root     1617 Jun 17 05:57 mpi_f08_callbacks.mod
-rwxr-xr-x.  5 root root      259 Jun 17 05:57 mpi_f08_ext.mod
-rwxr-xr-x.  5 root root    50346 Jun 17 05:57 mpi_f08_interfaces.mod
-rwxr-xr-x.  5 root root     2012 Jun 17 05:57 mpi_f08_interfaces_callbacks.mod
-rwxr-xr-x.  5 root root     9690 Jun 17 05:57 mpi_f08_types.mod
drwxr-xr-x.  2 root root     8192 Jun 19 16:53 openmpi
drwxr-xr-x.  2 root root     4096 Jun 17 06:05 pkgconfig
-rwxr-xr-x.  5 root root    49396 Jun 17 05:57 pmpi_f08_interfaces.mod

I have no name!@27fe216a4aed:/gsi$ env |grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/opt/lib64:/usr/local/lib

docker run options

I have no name!@27fe216a4aed:/gsi$ docker run -it --rm --name GSI --user 1000:1001 -v /home/xinzhang/jedi/gsi:/gsi -w /gsi xinzhang8noaa/common_libs:gnu6.2
groups: cannot find name for group ID 1001
I have no name!@27fe216a4aed:/gsi$


This command will start a isolated Linux session with all the libraries, tools needed to compile, run GSI. please ignore "groups: cannot find name for group ID 1001" and "I have no name!",as the container Linux does not have your account info.

  • -it : interactive session
  • --rm: the container will be delete once you exit from the session
  • --name GSI : session name
  • -v /home/xinzhang/jedi/gsi:/gsi : mount the current directory as /gsi in container
  • --user 1000:1001 : file access permission in container, it sets the same as the user's account on host machine. Using 'id' to check the uid and gid
  • -w /gsi: starting directory

We activate a docker image which include all libraries and tools needed for building GSI, WRF and FV3 etc. and the GSI directory is mounted as /gsi directory in the image.

Then, we can start to compile GSI.

compile GSI
I have no name!@7a59fc1a0829:/gsi$ mkdir build


I have no name!@7a59fc1a0829:/gsi$ cd build/


I have no name!@7a59fc1a0829:/gsi/build$ export FC=mpifort

I have no name!@7a59fc1a0829:/gsi/build$ cmake -DBUILD_CORELIBS=ON -DUSE_WRF=OFF -DBUILD_GLOBAL=ON ..
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is GNU 6.2.0
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
Setting paths for Generic System
/gsi
Setting GNU flags
Setting GNU Compiler Flags
-- Found MPI_C: /usr/local/lib/libmpi.so  
-- Found MPI_CXX: /usr/local/lib/libmpi_cxx.so;/usr/local/lib/libmpi.so  
-- Found MPI_Fortran: /usr/local/lib/libmpi_usempif08.so;/usr/local/lib/libmpi_usempi_ignore_tkr.so;/usr/local/lib/libmpi_mpifh.so;/usr/local/lib/libmpi.so  
-- Found NetCDF: /usr/local/lib/libnetcdff.so;/usr/local/lib/libnetcdf.so  
-- Found HDF5: /usr/local/lib/libhdf5.so;/usr/local/lib/libsz.so;/usr/local/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so;/usr/local/lib/libhdf5_hl.so;/usr/local/lib/libhdf5.so;/usr/local/lib/libsz.so;/usr/local/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so;/usr/local/lib/libhdf5hl_fortran.so;/usr/local/lib/libhdf5_hl.so;/usr/local/lib/libhdf5_fortran.so;/usr/local/lib/libhdf5.so;/usr/local/lib/libsz.so;/usr/local/lib/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.8.17") 
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.47.0") 
 trying to find lapack
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- A library with BLAS API found.
-- Looking for Fortran cheev
-- Looking for Fortran cheev - found
-- A library with LAPACK API found.
setting values for corelibs
in core-libs
in enkf
-- A library with BLAS API found.
-- A library with LAPACK API found.
-- Configuring done
-- Generating done
-- Build files have been written to: /gsi/build


I have no name!@7a59fc1a0829:/gsi/build$ nproc
8


I have no name!@7a59fc1a0829:/gsi/build$ make -j4
Scanning dependencies of target bufrlib_prm
Scanning dependencies of target bacio_v2.0.1
Scanning dependencies of target copy
[  0%] Generating ../../include/bufrlib.prm
Scanning dependencies of target crtm_v2.2.3
[  0%] Built target copy
[  0%] Building Fortran object core-libs/bacio/CMakeFiles/bacio_v2.0.1.dir/__/__/libsrc/bacio/baciof.f.o
[  0%] Building Fortran object core-libs/bacio/CMakeFiles/bacio_v2.0.1.dir/__/__/libsrc/bacio/bafrio.f.o
[  0%] Built target bufrlib_prm
[  0%] Building Fortran object core-libs/bacio/CMak..................
......................
......................
[100%] Linking Fortran executable ../../bin/enkf_gfs.x
[100%] Built target enkf_gfs.x

I have no name!@7a59fc1a0829:/gsi/build$ ls -al bin/gsi_global.x 
-rwxr-xr-x. 1 1000 1001 38298632 Jun 19 18:03 bin/gsi_global.x

If you have another directory in you host machine, which includes a GSI test case, for example : /home/xinzhang/jedi/gsitest, you can mount the test case directory as well:

docker run -it --rm --name GSI --user 1000:1001 -v /home/xinzhang/jedi/gsi:/gsi -v /home/xinzhang/jedi/gsitest:/gsitest -w /gsi xinzhang8noaa/common_libs:gnu6.2