Setup Development Environment

From OpenM++
Jump to: navigation, search

Contents

OpenM++ Requirements

Your development and runtime environment must meet following:

  • OS: 64 or 32 bits version of:
    • Linux (tested): Redhat / CentOS 7, Ubuntu 16+, also expected to work: Debian 7+, OpenSUSE 1.2+, Fedora 17+
    • Windows (tested): 10, 7, 2016, 2008R2 also expected to work: 8+, 2008, 2012
  • Support of c++11:
    • g++ 4.8+
    • Visual Studio 2017, also possible to use VS2015
  • (optional) if want to compile omc (openM++ compiler):
    • bison 2.7+ and flex 2.5.37+
  • (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 developemnt tools:

  • R 3.3+
  • Go 1.8+, on Windows required MinGw for g++ compiler
  • node.js LTS version

Check c++11 capabilities

Linux: To check g++ version type: g++ --version, expected output:

g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16)

Windows: Make sure you have Visual Studio 2017 installed with latest update.

If you are using different c++ vendor, i.e. Intel c++ then compile and run following test:

#include <iostream>
using namespace std;

int main(int argc, char** argv)
{
    auto get_name = [&argv](void) -> const char * { 
        return argv[0]; 
    };
    cout << "Hello from " << get_name() << "\n";
    return 0;
}

Save this code as hp.cpp, compile and run it:

g++ -std=c++11 -o hp hp.cpp
./hp

Expected output:

Hello from ./hp

Bison and Flex

Optional: If you want to recompile omc (OpenM++ compiler) then you must have bison 2.6+ and flex 2.5.35+ installed.

To check bison and flex version type following commands:

bison --version
flex --version

Expected output:

bison (GNU Bison) 2.7
flex 2.5.37

Windows:

Install MPI

It is possible to use OpenM++ without MPI, but highly recommended to have MPI installed on your local machine (or cluster).

Linux: To check your MPI version:

mpirun --version

Expected output:

mpirun (Open MPI) 1.10.6

You may need to load MPI module in your environment on RedHat / CentOS:

module load mpi/openmpi-x86_64
mpirun --version

Windows: download and install Microsoft MPI SDK and MPI Redistributable.

Test MPI

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 libaries 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

Install R

Download and install R:

It is recommended to use RStudio or RStudio Server for development.

Install Go

  • Windows:
    • download Go from https://golang.org/ and unpack into any directory, e.g.: C:\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_ws\
    • set your environment variables:
set GOROOT=C:\Go
set GOPATH=C:\go_ws
set PATH=%GOROOT%\bin;%GOPATH%\bin;%PATH%
cd %GOPATH%
C:\MinGW\set_distro_paths.bat
  • Linux:
    • download Go from https://golang.org/ and unpack into any directory, e.g.: ~/go
    • create your Go working directory, e.g.: ~/go_ws
    • set your environment variables:
export GOROOT=$HOME/go
export GOPATH=$HOME/go_ws
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Install node.js

You need node.js in order to build and develop openM++ UI. Please download and install stable version from Node.js. You can use installation package on Windows, which installs it by default into C:\node directory. In order to start development please open command prompt and type:

C:\node\nodevars.bat
cd C:\my-openm-dir\ompp-ui
npm install

Setup for Linux can be done through your favorite package manager or by directly downloading archive from Node.js:

curl https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz -o node.tar.xz
tar -xJf node.tar.xz
export PATH=$HOME/node/bin/:$PATH
cd my-oenm-dir/ompp-ui
npm install

Note: Sometime you can experience problem during npm install similar to:

npm ERR! 404 Not Found: pinkie@https://registry.npmjs.org/pinkie/-/pinkie-2.0.5.tgz

Please remove ompp-ui/package-lock.json and try again npm install.

<metadesc>OpenM++: open source microsimulation platform</metadesc>