PowerDEVS Installation in Linux

Step by Step Installation in SLC (flavor of RedHat /Fedora for CERN)

Setup environment

You need to install all the PowerDEVS dependencies.
You can guide yourself using the Dockerfile for CentOS7, where all dependencies are installed and the environment is setup. Check in particular the instalation of Scilab and enabling devtoolset-6

yum install -y centos-release-scl epel-release 
yum install -y make git devtoolset-6 boost-devel valgrind kcachegrind graphviz wget java-openjdk mesa-dri-drivers psmisc python-matplotlib python-devel h5py qt-devel gsl-devel gnuplot hdf5-devel qt-devel

Compile PowerDEVS

  1. Clone the repository https://gitlab.cern.ch/tdaq-simulation/powerdevs
  2. cd powerdevs
  3. make gui; make py2pdevs
    This will compile the following components: IGUI (pdme, pdppt, etc), engine (simulation core), models (atomics models in /atomics), py2pdevs python bindings (in /src/py2pdevs)
    If you run `make` or `make all` it might fail as it will attempt also to compile compile a c++ simulation executable, which requires a /build/model.h generated by the IGUI.

Running PowerDEVS IGUI

PowerDEVS must be executed with the /powerdevs/bin directory set as working directory. The executable is located in the /powerdevs/bin directory, so care must be taken (ej: from console cd /bin, and then ./pdme).

In order to compile models with c++11, make sure you have the correct version of g++. It is recommended to install dev-toolset (see below), so powerdevs should be executed as follows to use the right compiler:

scl enable devtoolset-2 "/home/mbonaven/gitlab/powerdevs/bin/pdme"

Basic example

Follow these steps in order to check if the installation is complete and correct:

  1. Open a terminal and set the PowerDEVS root folder as working directory:
    • cd <powerDevsFolder>
  2. Compile the lotka_volterra model:
    • bin/pdppt examples/continuous/lotka_volterra/lotka_volterra.pdm
    • open the pdm in the IGUI, click Simulate. It will first compile (output/model executable) and open a window to simulate. You can simulate from that window, or from command line as describe below.
  3. This should produce a standalone executable ready to simulate the model. Execute it as follows:
    • cd output
    • ./model -tf 300
  4. The execution should end with a plot like the one shown below:
lotka_volterra.png

Basic example in py2pdevs (for advanced users or developers)

This section documents how to run the basic example shown before using the py2pdevs interface. You can safely skip this if you are not planning to develop models using Python.

Using your preferred text editor, open a new file called lotka.py (inside the build/lib directory) and enter the following lines:

import py2pdevs.core as core
import py2pdevs.params as params

def lotka():
    params.parse_options()

    model = core.new_model(0, 'lotka_volterra')

    multiplier0 = model.create_qss_multiplier(model.top(), 'Multiplier 0', ['Purely static', 1e-6, 1e-3])
    integrator0 = model.create_qss_integrator(model.top(), 'QSS Integrator 0', ['QSS3', 1e-6, 1e-3, 0.5])
    integrator1 = model.create_qss_integrator(model.top(), 'QSS Integrator 1', ['QSS3', 1e-6, 1e-3, 0.5])
    wsum0 = model.create_qss_wsum(model.top(), 'WSum 0', [0.1,-0.1,0,0,0,0,0,0,2])
    wsum1 = model.create_qss_wsum(model.top(), 'WSum 1', [0.1,-0.1,0,0,0,0,0,0,2])
    gnuplot0 = model.create_gnuplot(model.top(), 'GnuPlot 0', ['2',"set xrange [0:%tf] @ set grid @ set title 'Lotka Volterra Model'","with lines title 'Preys'","with lines title 'Predators'","","",""])

    model.connect_models(wsum0, 0, integrator0, 0)
    model.connect_models(wsum1, 0, integrator1, 0)
    model.connect_models(multiplier0, 0, wsum1, 0)
    model.connect_models(multiplier0, 0, wsum0, 1)
    model.connect_models(integrator0, 0, gnuplot0, 0)
    model.connect_models(integrator0, 0, multiplier0, 0)
    model.connect_models(integrator0, 0, wsum0, 0)
    model.connect_models(integrator1, 0, gnuplot0, 1)
    model.connect_models(integrator1, 0, multiplier0, 1)
    model.connect_models(integrator1, 0, wsum1, 1)

    model.run()

if __name__ == '__main__':
    lotka()

Although we won't go into the details, here is a brief description of what is going on here:

  • The first two lines import the main py2pdevs modules: core, which provides the actual interface to the PowerDEVS engine, and params, a utility module that reads command-line arguments and supplies them along with other user-defined parameters to PowerDEVS.
  • Function lotka defines and runs the model, starting first with command-line parsing through the params module.
  • The last two lines simply define the main behavior of the script, which is given by the lotka function.

Once your script is saved, you can run it issuing the following command:

  • python lotka.py -tf 300

Notice the same syntax of the command-line arguments.

If everything goes OK, you should get the same plot shown in the previous section.

Installation in SLC6 Server

To run a simulation as a batch program PowerDEVS does not need to be installed in the machine as long as the simulation executable accesible (the output/model executable file).

Nevertheless scilab needs to be installed and necesary libraries:

  • sudo yum install gsl gsl-devel

  • sudo yum install libXScrnSaver

maybe java need to be installed too.



Installation in SLC6 Server Cloud Intrastrucuture



To run a simulation as a batch program PowerDEVS does not need to be installed in the machine as long as the simulation executable accesible (the output/model executable file).

Nevertheless scilab needs to be



Install X Display



- sudo yum groupinstall 'X Window System'



Install Scilab

from here: http://wiki.scilab.org/howto/install/linux

<a name="__DdeLink__424_1579196801"></a>Scilab Version 5.5.0 does not work with SLC6 because it needs GLIBC_2.14 (SLC6 uses GLIBC_2.12)

[$SHELL]
wget
http://www.scilab.org/download/5.4.1/scilab-5.4.1.bin.linux-x86_64.tar.gz

[$SHELL] cd <scilab-path>[$SHELL] tar xzvf

scilab-5.4.1.bin.linux-x86_64.tar.gz

# For 64 bits systems[$SHELL] cd <scilab-path>/scilab-5.4.1

[$SHELL] ./bin/scilab (this won't work as no display is available)



Load Scilab Backdoor module

- Follow “Moving Powerdevs out home directory”

- in builder.sce

// Action// ========================================tbx_builder_macros(toolbox_dir);tbx_builder_src(toolbox_dir);tbx_builder_gateway(toolbox_dir);//tbx_builder_help(toolbox_dir);tbx_build_loader(TOOLBOX_NAME, toolbox_dir);tbx_build_cleaner(TOOLBOX_NAME, toolbox_dir);



- To execute scilab in command line mode use: scilab-5.4.1/bin/scilab -nwni -f ../powerdevs-code/bin/loadBackDoor.sce

or use the <powerDEVS>/bin/startScilabCommandLine.sh script



Install GSL

- sudo yum install gsl



Installing Libraries





  • sudo yum install glibc.i686 alsa-lib.i686 libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686

  • <a name="__DdeLink__417_418540528"></a>sudo yum install libXScrnSaver

  • sudo yum install libxsss

sudo yum install alsa-lib.i686 dbus-libs.i686 e2fsprogs-libs.i686 expat.i686 fontconfig.i686 freetype.i686 glib2.i686 glibc.i686 keyutils-libs.i686 krb5-libs.i686 libcap.i686 libgcc.i686 libICE.i686 libpng.i686 libselinux.i686 libSM.i686 libstdc++.i686 libX11.i686 libXau.i686 libxcb.i686 libXcursor.i686 libXdmcp.i686 libXext.i686 libXfixes.i686 libXi.i686 libXinerama.i686 libXrandr.i686 libXrender.i686 libXScrnSaver.i686 libXv.i686 openssl.i686 qt.i686 qt-x11.i686 zlib.i686





Step by Step Installation in Ubuntu


You can guide yourself using the Dockerfile for CentOS7, converting 'yum' calls to 'apt-get' (name of libraries need to change as well). Check in particular the instalation of Scilab and enabling devtoolset-6


- Install GSL (for doing this I recommend you to follow this link)
- sudo apt-get install gsl-bin libgsl0-dev

- use /engine/makefile.include as attached. Contains the following lines (in
bold things I changed):
ifeq ($(UNAME), Linux)
..
CXXFLAGS = -Wall $(OPTFLAGS)
-DO_BINARY=0
..
GSLLIB = /usr/lib
GSLINC = /usr/include/gsl
LIBS = -lsimpd -lgsl -L$(GSLLIB)
..
INCLUDES = -I$(SRCENGINE) -I$(ATOMICS) -I$(BUILD) -L$(BUILDLIB)
-I$(GSLINC) -lgslcblas

- add PDNL models to Atomic folder (sinks, hybrid and examples folder).

An important thing to remark: Don't use the boost library which is located in afs!. This library was though for a CENTOS O.S., since you are in ubuntus it will not work. You should download the boost library for ubuntu, and then modify the places where BOOST is included in Makefile.include to the new place where boost was installed (it's probably that some of the libs that the makefile is including are also deprecated, for example the -mt suffix has been removed. The installed Boost libraries are multi-threading safe now). If you have a wrong boost library, this will be showed when you try to build your model!.


- If you get this compilation error: "
open with O_CREAT in second argument needs 3 arguments"

- It might be related to a bug in gcc version.

- Change lines 18 and 20 of file hybrids/logtoscilabtool.cpp adding the 3rd argunemt with value 0666 as follows:
if (getOs()==WINDOWS)
FOutHandler = open(FName, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666 );
else
FOutHandler = open(FName, O_WRONLY | O_CREAT | O_TRUNC, 0666);

-- MatiasAlejandroBonaventura - 2016-04-07

You can guide yourself using the Dockerfile for CentOS7, where all dependencies are installed and the environment is setup. Check in particular the instalation of Scilab and enabling devtoolset-6

Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r16 - 2022-03-04 - MatiasAlejandroBonaventura
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback