aivika-distributed: Parallel distributed discrete event simulation module for the Aivika library

[ bsd3, library, simulation ] [ Propose Tags ]

This package extends the aivika-transformers [1] package and allows running parallel distributed simulations. It uses an optimistic strategy known as the Time Warp method. To synchronize the global virtual time, it uses Samadi's algorithm.

Moreover, this package uses the author's modification that allows recovering the distributed simulation after temporary connection errors whenever possible. For that, you have to enable explicitly the recovering mode and enable the monitoring of all logical processes including the specialized Time Server process as it is shown in one of the test examples included in the distribution.

With the recovering mode enabled, you can try to build a distributed simulation using ordinary computers connected via the ordinary net. For example, such a distributed model could even consist of computers located in different continents of the Earth, where the computers could be connected through the Internet. Here the most exciting thing is that this is the optimistic distributed simulation with possible rollbacks. It is assumed that optimistic methods tend to better support the parallelism inherited in the models.

You can test the distributed simulation using your own laptop, although the package is still destined to be used with a multi-core computer, or computers connected in the distributed cluster.

There are additional packages that allow you to run the distributed simulation experiments by using the Monte-Carlo method. They allow you to save the simulation results in SQL databases and then generate a report or a set of reports consisting of HTML pages with charts, histograms, links to CSV tables, summary statistics etc. Please consult the AivikaSoft [3] website for more details.

Regarding the speed of simulation, the recent rough estimation is as follows. This estimation may change from version to version. For example, in version 1.0 the rollback log was rewritten, which had a significant effect.

The distributed simulation module is slower up to 8-15 times in comparison with the sequential aivika [2] simulation library using the equivalent sequential models. The lower estimation in 8 times is likely to correspond to complex models. The upper estimation in 15 times will probably correspond to quite simple event-oriented and process-oriented models, where the sequential module can be exceptionally fast. At the same time, the message passing between the logical processes can dramatically decrease the speed of distributed simulation, especially if the messages cause rollbacks. Thus, much depends on the distributed model itself.

When residing the logical processes in a computer with multi-core processor, you should follow the next recommendations. You should reserve at least 1 core for each logical process, or even reserve 2 cores if the logical process extensively sends and receives messages. Also you should additionally reserve at least 1 or 2 cores for each computational node. These additional processor cores will be used by the GHC run-time system that includes the garbage collector as well. The Aivika distributed module creates a huge amount of short-living small objects. Therefore, the garbage collector needs at least one core to utilize efficiently these objects.

You should compile your code with options -O2 and -threaded, but then launch it with run-time options +RTS -N.




Versions 0.1, 0.1.1, 0.1.3, 0.2, 0.3, 0.3.1, 0.5, 0.6, 0.7,, 0.7.2, 0.7.3, 0.7.4,,, 0.8, 1.0, 1.1, 1.1.1, 1.1.2, 1.2, 1.3
Change log
Dependencies aivika (>=5.3.1), aivika-transformers (>=5.3.1), array (>=, base (>= && <6), binary (>=, containers (>=, distributed-process (>=0.6.1), exceptions (>=, mtl (>=2.1.1), mwc-random (>=, random (>=, stm (>=2.4.2), time (>= [details]
License BSD-3-Clause
Copyright (c) 2015-2018. David Sorokin <>
Author David Sorokin
Maintainer David Sorokin <>
Category Simulation
Home page
Source repo head: git clone
Uploaded by DavidSorokin at Sat Apr 14 16:26:28 UTC 2018
Distributions NixOS:1.3
Downloads 3165 total (60 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-04-14 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees