This article details the work with inter-plugin dependencies in MegaMol™. The primary scenario is to have one (or many) plugins use Call classes exported by another plugin (and not the MegaMol™ core).

Actually, nothing was changed in the MegaMol™ core. Inter-plugin dependencies already worked, to some extent. The limits, and especially the behavior in error cases are described below.

Test Project: interplugin_test

The following project shows two plugins:

https://bitbucket.org/MegaMolDev/megamol_interplugin_test

Plugin A exports 2 modules and 1 call.

Plugin B exports one module using the call exported by modul A.

Exporting Call Header

Usually, modules and calls are only exported via their meta data description classes as part of the implementation in “plugin_instance”. This meta data is sufficient for the MegaMol™ core to instantiate the module at runtime. However, these classes are normally not exported by the plugins.

If you want to use a class, a Call, in other plugins at compile time, you have to export the type. You need to place the corresponding header file in the public export folder. For a typical case, have a look at the demo project: “./a/include/interplugin_test_a/IplgDemoCall.h” I also recommend to add the header files to the filter “Public Header Files” in the Visual Studio Solution Explorer.

Additionally, you need to export the class using the corresponding API macro: e.g. “INTERPLUGIN_TEST_A_API”, which is defined in the plugin’s primary header file, e.g. “interplugin_test_a/interplugin_test_a.h”

Of course, you still need to export the meta data description for the call itself in the “plugin_instance” definition (cf. “interplugin_test_a.cpp” line 51).

Using Call in another Plugin

Now, to use the Call in another Plugin, that one basically needs to link against the exporting Plugin. Following the demo project, the exporting plugin is called A and the using plugin in named B.

First A is a library and a normal development dependency for B. For Visual Studio, I recommend using the “configure.win.pl” and “ExtLibs.props.input” similar to any other 3rd-party library. In the demo project, the access to the subdirectory of A is hard coded in the “ExtLibs.props.input”. Then, you can use this user macro in the project settings:

  • C/C++ > General > Additional Include Directories
    • E.g. $(PluginAPath)include\
  • Linker > General > Additional Library Directories
    • E.g. $(PluginAPath)lib\$(PlatformName)\$(Configuration)\
  • Linker > Input > Additional Dependencies
    • E.g. interplugin_test_a.lib

As you see, the linker only uses the built input library of the plugin, not the compiled plugin A itself.

Now you can find the public header file of the call exported by the plugin, cf. “./b/src/IplgValueInvertB.cpp” line 3. Plugin B uses this class like any class exported from the core. Nothing special is required.

For Linux you could introduce similar settings in the “CMakeLists.txt” file. I did not.

Since I install everything of MegaMol™ into a local user directory (using the install prefix settings in the build scripts) all parts of MegaMol™ are available at the same location. This includes the core, which the “CMakeLists.txt” file already searches for and Plugin A, which is thus accidentally found too. So the public include files, which were copied when Plugin A was “installed” are already available. Linux does not require shared objects to link against their dependencies. The runtime loader is expected to resolve all issues. Thus, for building on Linux no additional settings are required.

If you want to be able to work with plugins not locally installed, you should write a corresponding find script for the base plugin A and use “find_package” in the “CMakeLists.txt” of plugin B. For now, I don’t care.

Configuring MegaMol™ with both Plugins

Just add both plugins, as usual, to the MegaMol™ configuration file. Either explicitly (recommended) or using file globing. You should keep the dependencies in mind. So you should load plugin A before you load plugin B. But technically, it does not matter.

Both plugins, all plugins, are basically Dlls. So if you load plugin B first, the Dll is loaded with all its dependencies. These include the Dll plugin A. So plugin A is in memory the, but the meta data is not known to the core yet. If then the command for loading plugin A is executed, the OS runtime is asked to load the Dll plugin A. Since that Dll is already in memory, the load succeeds and the plugins meta data is received and added to the core factory constructs.

Beware of Cyclic Dependencies

Cyclic Dependencies should be avoided, as always. In theory, they could work, like Plugin A uses a class from Plugin B and the other way round at the same time. However, if you are going towards such a scenario, I strongly recommend to create a third Plugin holding the shared classes, e.g. Calls.

Runtime Behavior if Dependent Plugin is not found

The OS runtime errors when a Dll (Plugin) cannot be loaded are rather useless. (I am working on something better here, but it is not as easy as one would think.) Usually, it only tells you that the Dll could not be loaded. So keep in mind, if you developing your plugins that other plugins you depend on, not only need to be available at compile time, but also need to be installed in the same bin directory for runtime access.

Version Number Tests

All plugins check their version numbers of Core and Vislib with the loading core. This is to avoid inconstancies at runtime. Imagine you build the Core, then work on your Plugin. In this work you stumble upon a bug in the Vislib and fix that. Then your core and your plugin use different Vislibs and only this very version check tells you that this is a bad idea.

Now, use that scenario and replace Vislib with plugin A. Welcome to hell. There currently is not version check implemented for cross-plugin dependencies. (Most likely, there will be no such check before the infamous coming “Call Interface Redesign”.) You need to be careful!

I have written about this before, but here is the official news reblogged from the SFB 716 website.

GPU-based interactive Visualization of Large Particle Data

20151112_vis2015_tutorialAt the end of October, the largest conference on scientific visualization – the IEEE VIS 2015 – took place in Chicago. This is an anual venue for experts from all over the world to present current research and discuss future challenges. With more than 1100 participants, the conference is considered the largest and most important international forum in this domain.

This year, Michael Krone and Guido Reina from the group of Prof. Ertl, together with Sebastian Grottel (TU Dresden) and Martin Falk (Linköping University, Sweden) organized a tutorial on interactive GPU-based Visualization of large particle data. They explained the technical aspects for ensuring high quality and interactivity of particle visualizaton, which are nowadays accepted as state of the art. Part of these techniques have been developed in the SFB716. Additionally, the presentation included details on abstractions required by continuosly growing data sets. Such abstractions were disucssed in the context of biomolecules and material surfaces as well as in the context of whole cell visualization.

The tutorial was very well received with over 50 participants. The course materials distributed there, including slides, source code and example data sets can be downloaded here.

We updated MegaMol to use cmake to build on Linux OS. This greatly improved the build process on Linux. But this also makes some more uncommon scenarios difficult to realize. For example, cmake usually automatically detects required dependencies. But, in some scenarios you need to override this magic.

In this article I show how to compile a second MegaMol on a system on which a MegaMol already has been compiled and installed. This is useful when working with experimental versions.

VISlib and visglut

First off you build the visglut the usual way. I assume here, that the installed MegaMol uses a different visglut as the one you want to build now:

mkdir megamol_x2
cd megamol_x2
svn co https://svn.vis.uni-stuttgart.de/utilities/visglut/tags/forMegaMol11 visglut
cd visglut/build_linux_make
make

If everything worked you can find the following files:

in megamol_x1/visglut/include:

GL/freeglut_ext.h
GL/freeglut.h
GL/freeglut_std.h
GL/glut.h
visglut.h
visglutversion.h

and in megamol_x2/visglut/lib:

libvisglut64.a
libvisglut64d.a

If so, let’s continue with the VISlib:

cd megamol_x2
svn co https://svn.vis.uni-stuttgart.de/utilities/vislib/tags/release_2_0 vislib
cd vislib

Now, there is the first action which is different from the default build process. As usual we will use the script cmake_build.sh. This script, however, per default registers the build directories in the cmake package registry. This enables cmake to find this package in its build trees. In this scenario, however, we do not want this special build to be automatically found, because we do not want to get in the way of our system-installed MegaMol. We thus deactivate the package registry.

This command configures and builds the VISlib, both for debug and release version:

./cmake_build.sh -dcmn

As always, if you encounter build problems due to the multi-job make, reduce the number of compile jobs:

./cmake_build.she -dcmnj 1

Note that I do not specify an install directory. I do not plan to install this special MegaMol. I just want to build, for example for a bug hunt.

MegaMolCore

It’s now time for the core.

cd megamol_x2
svn co https://svn.vis.uni-stuttgart.de/projects/megamol/core/branches/v1.1rc core
cd core

We first test the configuration by only configuring release and not building anything:

./cmake_build.sh -cv ../vislib -C -DCMAKE_DISABLE_FIND_PACKAGE_MPI=TRUE

Note that I also disabled MPI-Support here. The system I am building on has MPI installed, but I don’t want this MegaMol to use it.

The output should contain this line:

-- Found vislib: /home/sgrottel/megamol20150726/vislib/build.release/libvislib.a

This points to the right vislib, the one we specified. So all is well. We can build MegaMol, again without registering it’s build trees in the cmake package repository:

./cmake_build.sh -dcmnv ../vislib -C -DCMAKE_DISABLE_FIND_PACKAGE_MPI=TRUE

When all worked you got yourself the binaries:

megamol_x2/core/build.debug/libMegaMolCored.so
megamol_x2/core/build.release/libMegaMolCore.so

MegaMolConsole

Get yourself a working copy of the console:

cd megamol_x2
svn co https://svn.vis.uni-stuttgart.de/projects/megamol/frontends/console/branches/v1.1rc console
cd console

Again, we test if everything works by only configuring release and not building:

./cmake_build.sh -c -f ../core

The Console does not register its build tree per default, since no other project depends on the console. So we are fine here.

The output should contain these lines:

-- Looking for MegaMolCore with hints: ../core;../core/build.release;../core/share/cmake/MegaMolCore
-- Found MegaMolCore: /home/sgrottel/megamol20150726/core/build.release/libMegaMolCore.so
-- MegaMolCore suggests vislib at: /home/sgrottel/megamol20150726/vislib/build.release
-- MegaMolCore suggests install prefix: /usr/local
-- Using MegaMolCore install prefix
-- Found vislib: /home/sgrottel/megamol20150726/vislib/build.release/libvislib.a
-- Found AntTweakBar: /home/sgrottel/AntTweakBar/lib/libAntTweakBar.so
-- Found visglut: /home/sgrottel/megamol20150726/visglut/lib/libvisglut64.a

If the directories for other libraries are wrong, for example the AntTweakBar or the visglut use the cmake-typical DIR variable to give a search hint. Remember, relative paths might be confusion. Better use absolute paths. I don’t:

./cmake_build.sh -c -f ../core -C -Dvisglut_DIR=~/megamol20150709/visglut -C -DAntTweakBar_DIR=../../AntTweakBar

But in my case the cmake-magic worked fine in the first place. So, I configure both build types again:

./cmake_build.sh -dc -f ../core

Double check the output. Make sure the core, the vislib and the visglut are found in all the right places. If they are, built it:

./cmake_build.sh -dm

At this point you can quickly test your MegaMol. First open the megamol.cfg configuration file in a text editor and adjust the paths in there to yours. Then run MegaMol:

cd build.release
./MegaMolCon

If this seems ok, and if you have a local graphics card you can run the demo renderer:

./MegaMolCon -i demospheres s

Some MegaMol Plugin

Finally we need a plugin. I go for the mmstd_moldyn:

cd megamol_x2
svn co https://svn.vis.uni-stuttgart.de/projects/megamol/plugins/mmstd_moldyn/branches/v1.1rc mmstd_moldyn
cd mmstd_moldyn

The process is now exactly the same as with the console:

./cmake_build.sh -dcf ../core

The double check the directories for the core and the VISlib. If they are good, build the plugin:

./cmake_build.sh -dm

To test this plugin we go back to the console, and adjust the config file to load the plugin:

cd megamol_x2/console/build.release

Include the following lines in the config file. Obviously adjust the paths to what you need:

<plugin path="/home/dude/megamol_x2/mmstd_moldyn/build.release" name="mmstd_moldyn.mmplg" action="include" />
<shaderdir path="/home/dude/megamol_x2/mmstd_moldyn/Shaders" />

If you now run MegaMol it will try to load your plugin and will report it. The output console should contain something like:

200|Plugin mmstd_moldyn loaded: 11 Modules, 0 Calls
200|Plugin "mmstd_moldyn" (/home/sgrottel/megamol20150726/mmstd_moldyn/build.release/mmstd_moldyn.mmplg) loaded: 11 Modules, 0 Calls registered

And that’s it.

This Monday and Thursday the VII. Annual Meeting of the Boltzmann-Zuse-Society for Computational Molecular Engineering takes place in Kaiserslautern, organized by Martin Horsch. Basically it is a meeting for the groups from Stuttgart (VISUS, HLRS), Paderborn, Kaiserslautern and Dresden, to talk about simulation, analysis and visualization of molecular dynamics data. And to discuss our joint research and development projects. Of course, Joachim and I will be talking about current works with and on MegaMol. By the way: http://megamol.org

The ESF-funded junior research group VICCI dealt from 2012 until the end of 2014 with the development, control and integration of cyber physical systems (CPS) at the Faculty of Computer Science of the Dresden University of Technology. The scope includes smart home environments and supporting people in the ambient assisted living.

My work package for visualization and visual analysis has within the project investigated three essential aspects and corresponding solutions:

  • visual analysis of complex, multi-dimensional, multimodal, dynamic space-time data,
  • visualization in heterogeneous, mobile and distributed IT infrastructure, and
  • implementation of visualization systems and components.

Today I am writing about the visual analysis of complex space-time data.

teaser

Visual analysis serves as administrative overview of a current CPS, mainly for security reasons, as assistance during development, and the operation of the system. Particularly interesting are out-of-the-ordinary (erroneous) behavior and the formation of emergent system properties. For this a visual exploration with minimal previous assumptions is necessary. For example, certain data, like forces acting upon joints of a robot arm, be visualized more effectively by representations in geometrical context. This assumption however reduced the generality of visualization.

I thus developed a corresponding visualization of data collected by the CPS using coordinated views of continuous-time scatter plots, continuous-time parallel coordinate plots and temporal heatmaps. This application is capable of interactive real-time representation of generic multi-dimensional data and offers the means for a visual analysis. The developed system was published in the journal Computer Graphics Forum, the leading European Journal on Visualization. In the context of the evaluation, live data from our laboratory CPS war visualized, presented and discussed with a broad audience.

  • [DOI] S. Grottel, J. Heinrich, D. Weiskopf, and S. Gumhold, “Visual Analysis of Trajectories in Multi-Dimensional State Spaces,” Computer Graphics Forum, vol. 33, iss. 6, pp. 310-321, 2014.
    [Bibtex]
    @article {Grottel2014HDTraj,
      author = {Grottel, Sebastian and Heinrich, Julian and Weiskopf, Daniel and Gumhold, Stefan},
      title = {{Visual Analysis of Trajectories in Multi-Dimensional State Spaces}},
      year = {2014},
      journal = {Computer Graphics Forum},
    volume = {33},
    number = {6},
    pages = {310--321},
      doi = {10.1111/cgf.12352}
    }

DOI: 10.1111/cgf.12352

This visualization was implemented as a plugin for the MegaMol visualization system. The source code can be downloaded freely and can be used according to the enclosed License:

hdtraj.mmplugin.ziphdtraj.mmplugin.zip Multi-Dimensional Trajectory Visualization MegaMol Plugin
[99.7 KB; MD5: 0a6eaf465318b0f256ecfdf8a8b4ad50; More Info]

To compile the MegaMol system and the plugin, use the appropriate Instructions on the MegaMol website.

I like working with Software. I have fun handling large data sets and producing interactive 3D visualizations which are useful, nice and cool. On the way to create them I, of course, need a huge lot of functions, libraries and services. It is a painful fight till all those parts fit nicely together. But, I would be lying if I would say that this fight is not part of the fun. It is great seeing the parts from different persons matching together to a working whole. In my current projects source code combines from colleagues from Dresden, ex-colleagues from Stuttgart, my student assistants and my advised students.

However, the real pain are the interfaces and the stability of those parts. Of course, you could swap the implementation of anything behind a good interfaces without influencing the rest of the system. But, someone needs to show me a good interface, yet! I haven’t seen one without its problems, and I have seen many. The continuous development get increasingly difficult with each component added. Especially if there is no overseeing architect.

MegaMol-Highlevel-ArchitectureAs a matter of fact, MegaMol is currently exactly on that way down. It is actively used in Stuttgart and Dresden. I, of course, want to foster and extend that process. After all, MegaMol is my project and I am proud of it. But, the larger it gets and the more it is used, the harder it gets to continue the development. Several fundamental problems can only be solved with fundamental changes. These will bring displeasure. And I am not sure how to handle the necessary work load. On the one hand I am reducing my active development to act more like a director of the future development. On the other hand, the actual development is passed from one Ph.D. student to the next, like a scapegoat. This, of course, does not help. I am really not sure how to solve this.

configurator2MegaMol Modul Graph (10.1109/TVCG.2012.282)

But, I have my plans. “Partitioning”! And I know exactly which parts need to have my priority and which are critical. The main problems, however, are the interfaces in between. Those are far from being clean and therefore the whole current partitioning is in vain. The first tries to solve that were … semi-successful. But, I don’t even think of quitting!

Today, I am only writing a short note on MegaMol.

We have done it! We published the MegaMol system as systems paper:

  • [DOI] S. Grottel, M. Krone, C. Müller, G. Reina, and T. Ertl, “MegaMol — A Prototyping Framework for Particle-based Visualization,” Visualization and Computer Graphics, IEEE Transactions on, vol. 21, iss. 2, pp. 201-214, 2015.
    [Bibtex]
    @article{grottel2014megamol,
        author={Grottel, S. and Krone, M. and M\"{u}ller, C. and Reina, G. and Ertl, T.},
        journal={Visualization and Computer Graphics, IEEE Transactions on},
        title={MegaMol -- A Prototyping Framework for Particle-based Visualization},
        year={2015},
        month={2},
        volume={21},
        number={2},
        pages={201--214},
        keywords={Data models;Data visualization;Graphics processing units;Libraries;Rendering (computer graphics);Visualization},
        doi={10.1109/TVCG.2014.2350479},
        ISSN={1077-2626}
    }

Doi: 10.1109/TVCG.2014.2350479

All the hard work really paid off. MegaMol has now been published in the IEEE Journal “Transactions on Visualization and Computer Graphics”, in short TVCG. That is the top journal of the visualization community. I have to admit, I am pretty proud.

And I am curious what will come next. I would like to continue working with MegaMol, and to help to evolve the software even further. But, of course, this depends on my future employment. MegaMol has such a potential. *sigh*