RedHat 8 use Docker - openmpp/openmpp.github.io GitHub Wiki

Why Docker?

There are multiple cases when you want to use Docker containers for openM++ development:

  • build your models with latest version of openM++
  • build cluster-ready (and cloud-ready) version of your model without installing MPI on your host computer
  • do test run of your model in cluster environment without installing and configuring MPI cluster on multiple machines
  • build latest version of openM++ from source code without installing and configuring all necessary development tools

All above build and run tasks can be done without Docker and our wiki describes all steps necessary to achieve this. However in that case you will spend a few hours or even days with installing and configuring development and cluster environment. Use of Docker allow to skip unnecessary steps and focus on model development. Also because containers are isolated from host environment there is nothing (except of Docker itself) get installed on your host system and you keep it clean, no software versions conflicts.

To install Docker on RedHat do: dnf install podman

Where to find openM++ Docker images

You can download openM++ images from Docker Hub:

User name and home directory

Both containers openmpp/openmpp-run:redhat-8 and openmpp/openmpp-build:redhat-8 created with for user ompp, HOME=/home/ompp. To avoid permissions issues you may need to map that user to your host user namespace and use :z option if you want to mount host local directory, for example:

podman run -userns=host -v $HOME/build:/home/build:z -e OMPP_USER=build openmpp/openmpp-build:redhat-8 ./build-all

Above we are mapping container user build to our current host user and container user home directory /home/build to sub-folder $HOME/build.

Or if want to use container user models to run our models:

podman run -userns=host -v $HOME/models:/home/models:z -e OMPP_USER=models openmpp/openmpp-run:redhat-8 ./modelOne

How to use openmpp/openmpp-run:redhat-8 to run your models

To run openM++ model do:

podman run .... openmpp/openmpp-run:redhat-8 ./modelOne

For example, if your models are in $HOME/models/bin directory then:

podman run \
  -userns=host \
  -v $HOME/models/bin:/home/models:z \
  -e OMPP_USER=models \
  openmpp/openmpp-run:redhat-8 \
  ./modelOne

podman run \
  -userns=host \
  -v $HOME/models/bin:/home/models:z \
  -e OMPP_USER=models \
  openmpp/openmpp-run:redhat-8 \
  mpiexec --allow-run-as-root -n 2 MyModel_mpi -OpenM.SubValues 16

Also you can use -e OM_ROOT=/home/models/my-openMpp-dir to set environment variable for your model, if necessary.

To start shell inside of conatiner do:

podman run -it openmpp/openmpp-run:redhat-8 bash

Following environment variable is used to map container user and home directory to you host directory:

OMPP_USER=ompp   # default: ompp, container user name and HOME

How to use openmpp/openmpp-build:redhat-8 to build openM++ and models

To build latest version of openM++ from source code and rebuild your models do:

podman run .... openmpp/openmpp-build:redhat-8 ./build-all

For example, if your build in $HOME/build or in $HOME/build_mpi directory then:

podman run \
  -userns=host \
  -v $HOME/build:/home/build:z \
  -e OMPP_USER=build \
  openmpp/openmpp-build:redhat-8 \
  ./build-all

podman run \
  -userns=host \
  -v $HOME/build_mpi:/home/build_mpi:z \
  -e OMPP_USER=build_mpi \
  -e OM_MSG_USE=MPI \
  openmpp/openmpp-build:redhat-8 \
  ./build-all

podman run .... -e MODEL_DIRS=RiskPaths,IDMM      openmpp/openmpp-build:redhat-8 ./build-all
podman run .... -e OM_BUILD_CONFIGS=RELEASE,DEBUG openmpp/openmpp-build:redhat-8 ./build-all
podman run .... -e OM_MSG_USE=MPI                 openmpp/openmpp-build:redhat-8 ./build-all

Following environment variables used to control openM++ build:

OM_BUILD_CONFIGS=RELEASE,DEBUG # default: RELEASE,DEBUG for libraries and RELEASE for models
OM_MSG_USE=MPI                 # default: EMPTY
MODEL_DIRS=modelOne,NewCaseBased,NewTimeBased,NewCaseBased_bilingual,NewTimeBased_bilingual,IDMM,OzProj,OzProjGen,RiskPaths

Following environment variable is used to map container user and home directory to you host directory:

OMPP_USER=ompp   # default: ompp, container user name and HOME

To build only openM++ libraries and omc compiler do:

podman run .... openmpp/openmpp-build:redhat-8 ./build-openm

Environment variables to control build-openm: OM_BUILD_CONFIGS, OM_MSG_USE

To build only models do:

podman run .... openmpp/openmpp-build:redhat-8 ./build-models

Environment variables to control build-models: OM_BUILD_CONFIGS, OM_MSG_USE, MODEL_DIRS

For example, if want to build your own model MyModel copy model code into $HOME/build/models/MyModel directory and do:

podman run .... openmpp/openmpp-build:redhat-8 ./build-models
podman run .... -e MODEL_DIRS=MyModel openmpp/openmpp-build:redhat-8 ./build-models
podman run .... -e MODEL_DIRS=MyModel -e OM_BUILD_CONFIGS=RELEASE,DEBUG openmpp/openmpp-build:redhat-8 ./build-models

To build openM++ tools do any of:

podman run .... openmpp/openmpp-build:redhat-8 ./build-go   # Go oms web-service and dbcopy utility
podman run .... openmpp/openmpp-build:redhat-8 ./build-r    # openMpp R package
podman run .... openmpp/openmpp-build:redhat-8 ./build-ui   # openM++ UI

To create openmpp_redhat_YYYYMMDD.tar.gz deployment archive:

podman run .... openmpp/openmpp-build:redhat-8 ./build-tar-gz

Environment variables to control build-tar-gz: OM_MSG_USE, MODEL_DIRS

To customize build you can change any of build scripts inside of $HOME/build directory:

$HOME/build/build-all     # rebuild entire openM++ and create openmpp_redhat_YYYYMMDD.tar.gz archive
$HOME/build/build-openm   # rebuild entire openM++ runtime libraries and compiler
$HOME/build/build-models  # rebuild openM++ models specified by MODEL_DIRS
$HOME/build/build-go      # rebuild Go oms web-service and dbcopy utility
$HOME/build/build-r       # rebuild openMpp R package
$HOME/build/build-ui      # rebuild openM++ UI
$HOME/build/build-tar-gz  # create openmpp_redhat_YYYYMMDD.tar.gz archive

To start shell inside of container do:

podman run -it openmpp/openmpp-build:redhat-8 bash
⚠️ **GitHub.com Fallback** ⚠️