Running your first simulation

Prerequisites

This tutorial assumes that you have installed Batsim, batsched (a set of schedulers for Batsim) and robin (an experiment manager for Batsim).

The following Nix command installs the three aforementioned packages, but please read Installation first — as it may save you a lot of compilation time.

nix-env -f https://github.com/oar-team/nur-kapack/archive/master.tar.gz -iA batsim batsched batexpe

Checking software environment

You can run the following commands to make sure that the different tools are installed at the expected version.

echo "batsim: $(batsim --version)"
echo "simgrid: $(batsim --simgrid-version)"
echo "batsched: $(batsched --version)"
echo "robin: $(robin --version)"

The version numbers should be the following.

batsim: 4.2.0
simgrid: 3.34.0
batsched: 1.4.0
robin: v1.2.0

Retrieving simulation inputs

Now that the different programs can be used, simulation inputs are needed to execute the simulation. This tutorial uses a simulated platform and a workload that are both defined in Batsim’s repository. Retrieving these files is essentially a clone to Batsim’s repository at latest release.

# Download a tarball of Batsim's latest release.
batversion='4.2.0'
curl --output "/tmp/batsim-v${batversion}.tar.gz" \
    "https://framagit.org/batsim/batsim/-/archive/v${batversion}/batsim-v${batversion}.tar.gz"

# Extract tarball to /tmp/batsim-src-stable.
(cd /tmp && tar -xf "batsim-v${batversion}.tar.gz" && mv "batsim-v${batversion}" batsim-src-stable)

Preparing the simulation output directory

This is simply the creation of the directory in which the simulation results will be put.

# Create the directory if needed.
mkdir -p /tmp/expe-out

# Clean the directory's content if any.
rm -rf /tmp/expe-out/*

Executing the simulation manually

A Batsim simulation most of the time involves two different processes.

  1. Batsim itself, in charge of simulating what happens on the platform

  2. A decision process, in charge of taking all the decisions about jobs and resources. This is where scheduling algorithms are implemented.

As running the simulation involves two processes, first launch two terminals. Batsim can be executed in the first terminal with the following command.

batsim -p /tmp/batsim-src-stable/platforms/cluster512.xml \
       -w /tmp/batsim-src-stable/workloads/test_batsim_paper_workload_seed1.json \
       -e "/tmp/expe-out/out"

The scheduler can now be run in the second terminal to start the simulation. In this tutorial we will use the batsched decision process, which is the reference implementation of a Batsim decision process. The following command runs batsched with the EASY backfilling algorithm.

batsched -v easy_bf

The simulation should now start. Both processes should finish soon. The simulation results should now be written in EXPE_RESULT_DIR.

Executing the simulation with robin

Executing the simulation manually shows how to run one Batsim simulation by executing the two processes manually. This is important to understand how running a simulation works, but in most cases executing them by hand is not desired.

robin has been created to make running Batsim simulation easy and robust. It allows to see Batsim simulations as black boxes, which is convenient when simulation campaigns are to be conducted.

One way to use robin is to first define how the simulation should be executed then to execute the simulation. Generating the ./expe.yaml file, which describes the simulation instance description executed in Executing the simulation manually, can be done thanks to the following command.

robin generate ./expe.yaml \
      --output-dir=/tmp/expe-out \
      --batcmd="batsim -p /tmp/batsim-src-stable/platforms/cluster512.xml -w /tmp/batsim-src-stable/workloads/test_batsim_paper_workload_seed1.json -e /tmp/expe-out/out" \
      --schedcmd='batsched -v easy_bf'

Running the simulation can then be done with the following command.

robin ./expe.yaml

Robin’s displayed output shows the lifecycle of Batsim and the scheduler. Robin returns 0 if and only if the simulation has been executed successfully.

Robin can directly execute a simulation without creating a description file, and have different options that makes it easy to call from experiment scripts. Please refer to robin --help for more information about these features.