direkt zum Inhalt springen

direkt zum Hauptnavigationsmenü

Sie sind hier

TU Berlin

Inhalt des Dokuments


Quantitative stochastic simulation is a useful tool for studying performance of stochastic dynamic systems, but it can consume much time and computing resources. To overcome these limits, parallel or distributed computation is needed. Akaroa-2 makes an aproach to parallel simulation, that of multiple replications in parallel or MRIP.
NS-2 is a nice tool for network simulation, but does not provide support for statistical analysis of the obtained results. So by combining NS-2 and Akaroa-2 we add run-length control for simulations based on statistic measures to NS-2 as well as a speed-up if the simulation can be run on many hosts in parallel.

The more precise objective for this project was to combine the Network Simulator with Akaroa-2 and to make the changes only in the ns part. This should give the opportunity to monitor a running ns simulation while not writing out excessive trace files. In addition, akaroa-2 provides the nice feature of an almost linear speedup with the number of hosts due to the MRIP (Multiple Replications In Parallel) method.
ns-2 is a discrete event simulator targeted at networking research. It provides substantial support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks. For more information about Network Simulator check the URL:
Simulations are written in OTcl but if you need some specific behavior of the OTcl Classes you can write your own in C++.

For a good tutorial : www.isi.edu/nsnam/ns/tutorial/index.html
For a Tcl/Tk- tutorial : hegel.ittc.ukans.edu/topics/tcltk/
Akaroa-2 has been developed at the University of Canterbury in Christchurch, New Zealand by Prof. Dr. K. Pawlikowski, Dr. Don McNickle and Dr. Greg Ewing. It is designed for running quantitative stochastic discrete-event simulations on Unix multiprocessor systems or networks of heterogeneous Unix workstations. Instead of dividing up the program for parallelization - a tremendous effort -, multiple instances of an ordinary simulation program are run simultaneously on different processors.
Akaroa-2 is freely available for educational purposes. For details of the usage policy please read this copyright notice.

Jump Start


  • get AKAROA-2 and install it (might need some tweaking to run under Linux)
  • set AKAROA environment variable to point to your Akaroa-2 directory

    • we have v.2.7.4 running here

  • possibly include $AKAROA/bin in your PATH
  • get Ns-2 and install it

    • we have v. 2.26 v.2.1b6, v.2.1b7 and 2.1b7a running here

  • get files and install changed rng.h, rng.cc and new akaroa.cc into your /wherever/ns/ns-2/tools directory

  • Changes in the Makefile.in of ns:

    • set an include directory pointing to the header files (akaroa.H) of your akaroa installation
    • set a lib directory pointing to the akaroa libraries -L/$(AKAROA)/lib -lakaroa
    • in the same line, add -lfl (akaroa needs libfl.a, the flex library)
    • add akaroa.o to the objects list

  • run ./configure
  • run make clean; make depend; make etc. as described in the ns-Manual.
Happy simulating!
     Files to download:

rng.cc (CC, 10,6 KB)
rng.h (H, 6,6 KB)
akaroa.cc (CC, 2,7 KB)

Or as zip file: nsak.zip (ZIP, 8,3 KB)

In this file a new class Akaroa - derived from TclObject - is defined. The function calls from OTcl are mapped to Akaroa library calls. Also an new RNGImplementaion class was derived. It maps calls for a new uniformly distributed random number to the Akaroa Random Number Generator. Additionaly some intializations are performed.
When running multiple replications of a simulation model in parallel, it is important that each simulaton engine uses a unique stream of random numbers. So we had to exchange the Random Number Generator.

     rng.h and rng.cc

The class RNGImplementation has now a virtual long next() method instead of a normal one. The class RNG has a
static void setRNGImplementation(RNGImplementation *imp)
method, to set a new RNGImplementation when needed. The Akaroa-class uses it to install its own implementation. Due to its dynamic nature the random number stream of RNG is a pointer now. We added reference counting for the stream to ensure that there is only one RNGImplementation object.
In your ns-simulation.tcl file do the following:
  1. instantiate a new Akaroa object in the Tclscript method
    set ak [new Akaroa]
  2. if you want to observe more than one parameter, tell Akaroa about it:
    $ak AkDeclareParameters $number_of_parameters
    else leave this line out
  3. inform Akaroa about each parameter change
    - one parameter:
         $ak AkObservation $delay

    - more parameters:
         $ak AkObservation 1 $delay
         $ak AkObservation 2 $packet_size
If the parameter change is easily observed within the C++ part just

     #include <akaroa.H>

into your module and call

     AkObservation (observation);


     AkObservation (parameternumber, observation);

Running a ns-2 simulation under akaroa-2
First, you have to start the akmaster process that controls the parallelization and the random number generator.

> akmaster &

Next, start the akslave process on every machine that you want to run your simulation on. It collects the results and starts and terminates the simulations locally.

> akslave &

You can use the BatchDistribution tool for this. This java tool will login on your behalf using ssh and run any command specified.
Last, start akrun with the parameters like the number of hosts and the program to be executed, e.g.:

> akrun -n 5 ns mm1.tcl

Eventually, a result like this should appear:

#Results obtained using the Akaroa2(c) automatic parallel simulation manager.
Example ns script
MM1 - Queueing system (TCL, 1,4 KB)
You should make sure that your simulation reaches a steady state, especially when you use more realistic traffic models, like self-similar traffic. Akaroa2 will produce accurate results characterizing steady-state behaviour of the simulated system only if that system can reach steady state within a reasonable time interval. Simulation of systems converging to steady state extremely slowly, or systems that are unstable and never reach steady-state, will be automatically stopped.

If you intend to execute a terminating simulation instead of steady-state one, then you need to use Akaroa2 in Independent Observation Mode; see Section 2.6 of the Akaroa2's manual.

To top

Combination of AKAROA-­‐2 and NS-2

Hagen Woesner, Eugen Gillich, Andreas Köpke (release)

Now works with ns-2 v.2.26, fixed a bug (AkRandom() replaced by AkRandomReal()*MAX_INT) and simplified akaroa.cc.

Note: The new RNG of ns 2.26 has a complex interface, the rng.cc and rng.h you can download here support only the important subset. Write a mail, if somebody actually uses the new interface - this will result in link errors.


Zusatzinformationen / Extras

Quick Access:

Schnellnavigation zur Seite über Nummerneingabe

Auxiliary Functions