OpenMpp Setup Development Environment - openmpp/openmpp.github.io GitHub Wiki
Your development and runtime environment must meet following:
- OS: 64 or 32 bits version of:
- Linux (tested): Debian stable (12) 11 and 10, MX Linux 23, 21 and 19, Ubuntu 22.04, RedHat 9+, (Ubuntu 20.04 and RedHat 8 may also work but not tested regualry)
- Windows (tested): 11, 10, may work on 7
- tested on MacOS latest, may work starting from Catalina 10.15 and Big Sur 11.1+, including new Apple Arm64 CPU (a.k.a. M1)
Note: It does work on most of latest Linux'es, any Windows 7+ or 2008R2+, 32 and 64 bits. We just not testing it regularly on every possible Windows / Linux version.
- Support of c++17:
- g++ >= 8.3+
- Visual Studio 2022, including Community Edition, Visual Studio 2019 also works, but not tested regularly
- Xcode 11.2+
- (optional) if want to build omc (openM++ compiler) from sources:
- bison 3.3+ and flex 2.6+
- (optional) it is recommended to have MPI installed on your local machine or in your HPC cluster:
- Linux (tested): OpenMPI 1.6+
- Windows (tested): Microsoft MPI v8+, expected to work starting from HPC Pack 2012 R2 MS-MPI Redistributable Package
- expected to work: MPICH (MS-MPI is in fact MPICH redistributed by Microsoft)
Optional development tools:
- R 3.5+
- Go 1.19+, on Windows required MinGw for g++ compiler
- node.js LTS version
Linux: To check g++ version type: g++ --version
, expected output:
g++ (Debian 8.3.0-6) 8.3.0 # Debian 10 and MX Linux 19
g++ (Debian 10.2.1-6) 10.2.1 20210110 # Debian 11 and MX Linux 21
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 # Ubuntu 20.04
g++ (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5) # RedHat 8, Rocky Linux, AlmaLinux
Note: Above output does not include all possible Linux versions and may be outdated, openM++ supports latest Linux distributions.
MacOS: To check c++ version type: clang --version
or g++ --version
, expected output:
Apple clang version 11.0.0 (clang-1100.0.33.12)
MacOS: install command line developer tools, if not installed already by Xcode: xcode-select --install
Windows: Make sure you have Visual Studio 2022 or 2019 installed with latest update (VS 2017 is not supported but may work).
If you are using different c++ vendor, i.e. Intel c++ then compile and run following test:
#include <iostream>
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
const map<string, string> capitals {
{ "Poland", "Warsaw"},
{ "France", "Paris"},
{ "UK", "London"},
{ "Germany", "Berlin"}
};
// print Country: Capital
for (const auto & [k,v] : capitals)
{
cout << k << ": " << v << "\n";
}
return 0;
}
Save above code as h17.cpp
, compile and run it:
g++ -std=c++17 -o h17 h17.cpp
./h17
Expected output:
France: Paris
Germany: Berlin
Poland: Warsaw
UK: London
Optional: If you want to recompile omc (OpenM++ compiler) then you need bison version >= 3.3 and flex 2.6+ installed.
To check bison and flex version type following commands:
bison --version
flex --version
Expected output:
bison (GNU Bison) 3.3.2 # Debian 10 and MX Linux 19
bison (GNU Bison) 3.5.1 # Ubuntu 20.04
bison (GNU Bison) 3.7.5 # Debian 11 and MX Linux 21
bison (GNU Bison) 3.0.4 # RedHat 8: this version is too OLD
flex 2.6.4
RedHat 8
You need a newer version of bison if you want to rebuild openM++ compiler (omc). One way of doing it is to rebuild bison from sources:
curl -o bison-src.tar.gz https://ftp.gnu.org/gnu/bison/bison-3.7.5.tar.gz
tar -xzf bison-src.tar.gz
cd bison-3.7.5
./configure --prefix=${HOME}/bison
make
make install
In order to use a newer version of bison export it to your environment:
export PATH=${HOME}/bison/bin:${PATH}
export LDFLAGS="-L${HOME}/bison/lib ${LDFLAGS}"
To verify result do bison --version
, expected output:
bison (GNU Bison) 3.7.5
Potential issue: If make
fail with error about missing makeinfo
then you may need to install it from official RedaHat PowerTools repository:
dnf install dnf-plugins-core
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf config-manager --set-enabled powertools
dnf install texinfo
Windows:
- download Windows version of bison and flex
- if your OpenM++ checkout folder is:
C:\SomeDir\
then unzipwin_flex_bison-2.5.24.zip
intoC:\SomeDir\bin\
To check bison and flex version type following commands with current directory C:\SomeDir\bin\
:
win_bison --version
win_flex --version
Expected output:
bison (GNU Bison) 3.7.4
flex 2.6.4
MacOS Bison:
Bison version included in MacOS bison (GNU Bison) 2.3
released in 2006 and too old for openM++.
You can install bison 3.8 from HomeBrew or from (MacPorts)[https://www.macports.org/]
MacOS Bison from HomeBrew:
- install HomeBrew from GUI terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- install bison 3.8 using HomeBrew:
brew install [email protected]
- export bison, you may also want to add it into your .zprofile: if MacOS on Intel CPU:
export PATH="/usr/local/opt/bison/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/bison/lib ${LDFLAGS}"
if MacOS on Apple Arm64 CPU (a.k.a. M1):
export PATH="/opt/homebrew/opt/bison/bin:${PATH}"
export LDFLAGS="-L/opt/homebrew/opt/bison/lib ${LDFLAGS}"
- verify bison version
bison --version
....
bison (GNU Bison) 3.8.2
OpenM++ is using MPI to run the models on multiple computers in your network, in cloud or HPC cluster environment.
Linux: To check your MPI version:
[user@host ~]$ mpirun --version
mpirun (Open MPI) 1.10.7
You may need to load MPI module in your environment on RedHat:
module load mpi/openmpi-x86_64
mpirun --version
Windows: To check your MPI version:
C:\> mpiexec /?
Microsoft MPI Startup Program [Version 10.0.12498.5]
........
Windows: download and install Microsoft MPI SDK and MPI Redistributable.
You can test your MPI environment with following code:
#include <mpi.h>
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
int mpiCommSize;
int mpiRank;
int procNameLen;
char procName[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &mpiCommSize);
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
MPI_Get_processor_name(procName, &procNameLen);
cout << "Process: " << mpiRank << " of " << mpiCommSize << " name: " << procName << endl;
MPI_Finalize();
return 0;
}
Save this code as mhp.cpp
, compile and run it:
mpiCC -o mhp mhp.cpp
mpirun -n 4 mhp
Expected output is similar to:
Process: 0 of 4 name: omm.beyond2020.com
Process: 2 of 4 name: omm.beyond2020.com
Process: 1 of 4 name: omm.beyond2020.com
Process: 3 of 4 name: omm.beyond2020.com
Windows: To build MPI tests in Visual Studio:
- create C++ command-line project
- adjust following in project properties:
- VC Directories -> Include Directories -> C:\Program Files\Microsoft MPI\Inc
- VC Directories -> Library Directories -> C:\Program Files\Microsoft MPI\Lib\i386
- Linker -> Input -> Additional Dependencies -> msmpi.lib
- build it and run under Visual Studio debugger
Please use amd64
version of MS MPI libraries if you want to build 64bit version.
To run MPI test on Windows type following in your command-line prompt:
mpiexec -n 4 mhp.exe
Expected output is similar to:
Process: 3 of 4 name: anatolyw7-om.beyond2020.local
Process: 2 of 4 name: anatolyw7-om.beyond2020.local
Process: 0 of 4 name: anatolyw7-om.beyond2020.local
Process: 1 of 4 name: anatolyw7-om.beyond2020.local
Download and install R version 3.5+ (v4+ not tested):
- Windows: https://cran.r-project.org/bin/macosx/R-3.6.3.nn.pkg
- on Linux use your package manager, e.g.:
sudo yum install R
- MacOS on Intel CPU: https://cran.r-project.org/bin/macosx/R-3.6.3.nn.pkg
It is recommended to use RStudio or RStudio Server for development.
-
Windows:
- download Go from https://golang.org/ and install into any directory, e.g.:
C:\Program Files\go
- download MinGw from your preferable distribution, ex: https://nuwen.net/mingw.html and unpack into any directory:
C:\MinGW\
- create your Go working directory, e.g.:
C:\go_workspace\
- set your environment variables:
- download Go from https://golang.org/ and install into any directory, e.g.:
set GOPATH=C:\go_workspace
set PATH=%GOPATH%\bin;%PATH%
cd %GOPATH%
C:\MinGW\set_distro_paths.bat
It is recommended to use Visual Studio Code for development.
- MacOS on Intel CPU: download and install fresh Go version, for example: https://golang.org/dl/go1.16.3.darwin-amd64.pkg
- MacOS on Arm64 CPU: download and install fresh Go version, for example: https://golang.org/dl/go1.16.3.darwin-arm64.pkg
-
MacOS Go also can be installed from
go1.16.3.linux-amd64.tar.gz
orgo1.16.3.linux-arm64.tar.gz
archive, similar to Linux - MacOS: include into your .zprofile PATH to Go, for example:
export GOROOT=$HOME/go
export PATH=$GOROOT/bin:${PATH}
Note: above version number 1.16.3 is only an example, please most recent stable version.
-
Linux:
- download Go, for example version 1.16.3 from: https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
- unpack into any directory, e.g.:
~/go
- set your environment variables (in .profile or .bash_profile or .bashrc, etc.):
export GOROOT=$HOME/go
export PATH=$GOROOT/bin:${PATH}
If you want to copy models database content from SQLite to other vendors then you may also need to install unixODBC development package:
su -c "yum install unixODBC unixODBC-devel"
Currently supported database vendors are: SQLite (default), Microsoft SQL Server, MySql, PostgreSQL, IBM DB2, Oracle. You can use dbcopy utility to copy model data between any of vendors above, for example copy from MySQL to MSSQL or from PostgeSQL to SQLite.
You need node.js
in order to build and develop openM++ UI. Please download and install stable version from Node.js.
Windows
- Use any of:
- MSI installer: https://nodejs.org/dist/v14.16.1/node-v14.16.1-x64.msi
- Zip archive: https://nodejs.org/dist/v14.16.1/node-v14.16.1-win-x64.zip
- if you are using archive then unpack it into
C:\node
directory and to start development open command prompt and type:
C:\node\nodevars.bat
cd C:\my-openm-plus-plus-dir\ompp-ui
npm install
Linux
- Use your favorite package manager
- Or directly download archive from Node.js and unpack into
$HOME/node
:
curl https://nodejs.org/dist/v14.16.1/node-v14.16.1-linux-x64.tar.xz -o node.tar.xz
mkdir $HOME/node
tar -xJf node.tar.xz -C node --strip-components=1
- add PATH to Node into your .bash_profile (or .profile or .bashrc, etc):
export PATH=$HOME/node/bin/:${PATH}
- checkout and build UI:
cd my-openm-plus-plus-dir
git clone https://github.com/openmpp/UI.git ompp-ui
cd ompp-ui
npm install
npm run build
MacOS on Intel CPU
- Use any of:
- if you are using archive then unpack it into
$HOME/node
and try checkout and build UI:
mkdir $HOME/node
tar -xzf node-v14.16.1-darwin-x64.tar.gz -C node --strip-components=1
- add PATH to Node into your .zprofile:
export PATH=$HOME/node/bin/:${PATH}
- checkout and build UI as described in Linux section above
MacOS on Arm64 CPU
- install HomeBrew from GUI terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- install Node.js LTS version using HomeBrew:
brew install node@14
- add PATH to Node into your .zprofile:
export PATH=/opt/homebrew/opt/node@14/bin:${PATH}
- checkout and build UI as described in Linux section above
Note: In examples above node-v14.16.1
is an example of current LTS (long term support) version. Please check Node.js site to download latest LTS version.