Skip to content

Windows use Docker

esseff edited this page Dec 29, 2023 · 9 revisions

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.

In order to use containers Docker for Windows must be installed. It can be done on your host system or on virtual machine. There are short notes about Docker installation at the bottom of that page.

Where to find openM++ Docker images

You can download openM++ images from Docker Hub:

How to use openmpp/openmpp-run:windows-20H2 to run your models

To run openM++ model do:

docker run .... openmpp/openmpp-run:windows-20H2 MyModel.exe

For example, if your models are in C:\my\models\bin directory then:

docker run -v C:\my\models\bin:C:\ompp openmpp/openmpp-run:windows-20H2 MyModel.exe
docker run -v C:\my\models\bin:C:\ompp openmpp/openmpp-run:windows-20H2 mpiexec -n 2 MyModel_mpi.exe -OpenM.SubValues 16
docker run -v C:\my\models\bin:C:\ompp -e OM_ROOT=C:\ompp openmpp/openmpp-run:windows-20H2 MyModel.exe

also you can use -e OM_ROOT=C:\ompp to set environment variable for your model, if necessary.

To start command prompt do:

docker run -v C:\my\models\bin:C:\ompp -it openmpp/openmpp-run:windows-20H2

How to use openmpp/openmpp-build:windows-20H2 to build openM++ and models

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

docker run .... openmpp/openmpp-build:windows-20H2 build-all

For example, if your build in C:\my\build directory then:

docker run -v C:\my\build:C:\build openmpp/openmpp-build:windows-20H2 build-all
docker run -v C:\my\build:C:\build -e OM_BUILD_PLATFORMS=x64 openmpp/openmpp-build:windows-20H2 build-all
docker run -v C:\my\build:C:\build -e MODEL_DIRS=RiskPaths   openmpp/openmpp-build:windows-20H2 build-all

Following environment variables used to control openM++ build:

set OM_BUILD_CONFIGS=Release,Debug (default: Release)
set OM_BUILD_PLATFORMS=Win32,x64   (default: Win32)
set OM_MSG_USE=MPI                 (default: EMPTY)
set MODEL_DIRS=modelOne,NewCaseBased,NewTimeBased,NewCaseBased_bilingual,NewTimeBased_bilingual,IDMM,OzProj,OzProjGen,RiskPaths

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

docker run .... openmpp/openmpp-build:windows-20H2 build-openm

Environment variables to control build-openm: OM_BUILD_CONFIGS, OM_BUILD_PLATFORMS, OM_MSG_USE

To build models do:

docker run .... openmpp/openmpp-build:windows-20H2 build-models

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

For example, if want to build your own model MyModel copy model code into C:\my\build\models\MyModel directory and do:

docker run -v C:\my\build:C:\build -e MODEL_DIRS=MyModel openmpp/openmpp-build:windows-20H2 build-models
docker run -v C:\my\build:C:\build -e MODEL_DIRS=MyModel -e OM_BUILD_PLATFORMS=x64 openmpp/openmpp-build:windows-20H2 build-models

To build openM++ tools do any of:

docker run .... openmpp/openmpp-build:windows-20H2 build-go   # Go oms web-service and dbcopy utility
docker run .... openmpp/openmpp-build:windows-20H2 build-r    # openMpp R package
docker run .... openmpp/openmpp-build:windows-20H2 build-perl # Perl utilities
docker run .... openmpp/openmpp-build:windows-20H2 build-ui   # openM++ UI

To create openmpp_win_YYYYMMDD.zip deployment archive:

docker run .... openmpp/openmpp-build:windows-20H2 build-zip

Environment variables to control build-zip: OM_MSG_USE, MODEL_DIRS

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

C:\my\build\build-all.bat     # rebuild entire openM++ and create openmpp_win_YYYYMMDD.tar.gz archive
C:\my\build\build-openm.bat   # rebuild entire openM++ runtime libraries and compiler
C:\my\build\build-models.bat  # rebuild openM++ models specified by MODEL_DIRS
C:\my\build\build-go.bat      # rebuild Go oms web-service and dbcopy utility
C:\my\build\build-r.bat       # rebuild openMpp R package
C:\my\build\build-ui.bat      # rebuild openM++ UI
C:\my\build\build-zip.bat     # create openmpp_win_YYYYMMDD.zip archive

To open cmd command prompt or Perl command prompt:

docker run -v C:\my\build:C:\build -it openmpp/openmpp-build:windows-20H2 cmd
docker run -v C:\my\build:C:\build -it openmpp/openmpp-build:windows-20H2 C:\perl\portableshell

Docker for Windows installation

Please follow official Microsoft documentation and Docker documentation to download and install Docker for Windows. There are few notes below, which you may find useful.

Final result should be "Docker is running":

Docker is running

You should do "Switch to Windows containers":

Switch to Windows containers done

This menu can be accessed by right-clicking the Docker icon in the system tray, which is normally in the lower right corner of the display.

Docker installation require Hyper-V Windows feature "On":

Windows features to run Docker

If you installing Docker inside of VMware virtual machine then it may be necessary to turn on "Virtualize Intel VT-x/EPT or AMD-V/RVI" settings. You can turn it off after setup completed:

VMware settings to install Docker

Home

Getting Started

Model development in OpenM++

Using OpenM++

Model Development Topics

OpenM++ web-service: API and cloud setup

Using OpenM++ from Python and R

Docker

OpenM++ Development

OpenM++ Design, Roadmap and Status

OpenM++ web-service API

GET Model Metadata

GET Model Extras

GET Model Run results metadata

GET Model Workset metadata: set of input parameters

Read Parameters, Output Tables or Microdata values

GET Parameters, Output Tables or Microdata values

GET Parameters, Output Tables or Microdata as CSV

GET Modeling Task metadata and task run history

Update Model Profile: set of key-value options

Update Model Workset: set of input parameters

Update Model Runs

Update Modeling Tasks

Run Models: run models and monitor progress

Download model, model run results or input parameters

Upload model runs or worksets (input scenarios)

User: manage user settings and data

Model run jobs and service state

Administrative: manage web-service state

Clone this wiki locally