bscpkgs/garlic/doc/execution.ms

255 lines
8.7 KiB
Plaintext
Raw Normal View History

2020-10-07 18:34:08 +02:00
.TL
2020-10-13 12:13:56 +02:00
Garlic: the execution pipeline
2020-10-07 18:34:08 +02:00
.AU
Rodrigo Arias Mallo
.AI
Barcelona Supercomputing Center
.AB
.LP
This document covers the execution of experiments in the Garlic
benchmark, which are performed under strict conditions. The several
stages of the execution are documented so the experimenter can have a
global overview of how the benchmark runs under the hood.
2020-10-13 14:07:34 +02:00
The results of the experiment are stored in a known path to be used in
posterior processing steps.
2020-10-07 18:34:08 +02:00
.AE
.\"#####################################################################
.nr GROWPS 3
.nr PSINCR 1.5p
.\".nr PD 0.5m
.nr PI 2m
\".2C
.\"#####################################################################
.NH 1
Introduction
.LP
Every experiment in the Garlic
2020-10-13 12:13:56 +02:00
benchmark is controlled by a single
2020-10-07 18:34:08 +02:00
.I nix
2020-10-13 12:13:56 +02:00
file placed in the
.CW garlic/exp
subdirectory.
Experiments are formed by several
.I "experimental units"
or simply
.I units .
A unit is the result of each unique configuration of the experiment
(typically involves the cartesian product of all factors) and
consists of several shell scripts executed sequentially to setup the
2020-10-07 18:34:08 +02:00
.I "execution environment" ,
2020-10-13 12:13:56 +02:00
which finally launch the actual program being analyzed.
2020-10-07 18:34:08 +02:00
The scripts that prepare the environment and the program itself are
called the
.I stages
2020-10-13 12:13:56 +02:00
of the execution and altogether form the
2020-10-07 18:34:08 +02:00
.I "execution pipeline"
or simply the
.I pipeline .
The experimenter must know with very good details all the stages
2020-10-13 12:13:56 +02:00
involved in the pipeline, as they have a large impact on the execution.
2020-10-07 18:34:08 +02:00
.PP
2020-10-13 12:13:56 +02:00
Additionally, the execution time is impacted by the target machine in
which the experiments run. The software used for the benchmark is
carefully configured and tuned for the hardware used in the execution;
in particular, the experiments are designed to run in MareNostrum 4
cluster with the SLURM workload manager and the Omni-Path
interconnection network. In the future we plan to add
support for other clusters in order to execute the experiments in other
machines.
2020-10-07 18:34:08 +02:00
.\"#####################################################################
.NH 1
Isolation
.LP
The benchmark is designed so that both the compilation of every software
package and the execution of the experiment is performed under strict
2020-10-13 12:13:56 +02:00
conditions. We can ensure that two executions of the same experiment are
actually running the same program in the same software environment.
2020-10-07 18:34:08 +02:00
.PP
All the software used by an experiment is included in the
.I "nix store"
2020-10-13 12:13:56 +02:00
which is, by convention, located at the
2020-10-07 18:34:08 +02:00
.CW /nix
directory. Unfortunately, it is common for libraries to try to load
software from other paths like
.CW /usr
or
.CW /lib .
It is also common that configuration files are loaded from
.CW /etc
and from the home directory of the user that runs the experiment.
Additionally, some environment variables are recognized by the libraries
used in the experiment, which change their behavior. As we cannot
control the software and configuration files in those directories, we
2020-10-13 12:13:56 +02:00
couldn't guarantee that the execution behaves as intended.
2020-10-07 18:34:08 +02:00
.PP
2020-10-13 12:13:56 +02:00
In order to avoid this problem, we create a
2020-10-07 18:34:08 +02:00
.I sandbox
where only the files in the nix store are available (with some other
exceptions). Therefore, even if the libraries try to access any path
outside the nix store, they will find that the files are not there
2020-10-13 12:13:56 +02:00
anymore. Additionally, the environment variables are cleared before
entering the environment (with some exceptions as well).
2020-10-07 18:34:08 +02:00
.\"#####################################################################
.NH 1
2020-10-13 12:13:56 +02:00
Execution pipeline
2020-10-07 18:34:08 +02:00
.LP
2020-10-13 12:13:56 +02:00
Several predefined stages form the
2020-10-07 18:34:08 +02:00
.I standard
2020-10-13 12:13:56 +02:00
execution pipeline and are defined in the
.I stdPipeline
array. The standard pipeline prepares the resources and the environment
to run a program (usually in parallel) in the compute nodes. It is
divided in two main parts:
connecting to the target machine to submit a job and executing the job.
Finally, the complete execution pipeline ends by running the actual
program, which is not part of the standard pipeline, as should be
defined differently for each program.
2020-10-07 18:34:08 +02:00
.NH 2
Job submission
.LP
2020-10-13 12:13:56 +02:00
Some stages are involved in the job submission: the
2020-10-07 18:34:08 +02:00
.I trebuchet
stage connects via
.I ssh
to the target machine and executes the next stage there. Once in the
target machine, the
2020-10-13 14:07:34 +02:00
.I runexp
stage computes the output path to store the experiment results, using
2020-11-06 12:31:39 +01:00
the user in the target machine and changes the working directory there.
In MareNostrum 4 the output path is at
.CW /gpfs/projects/bsc15/garlic/$user/out .
2020-10-13 14:07:34 +02:00
Then the
2020-10-07 18:34:08 +02:00
.I isolate
2020-10-13 12:13:56 +02:00
stage is executed to enter the sandbox and the
.I experiment
2020-10-13 14:07:34 +02:00
stage begins, which creates a directory to store the experiment output,
and launches several
2020-10-13 12:13:56 +02:00
.I unit
stages.
.PP
Each unit executes a
2020-10-07 18:34:08 +02:00
.I sbatch
2020-10-13 12:13:56 +02:00
stage which runs the
2020-10-07 18:34:08 +02:00
.I sbatch(1)
2020-10-13 14:07:34 +02:00
program with a job script that simply calls the next stage. The
2020-10-13 12:13:56 +02:00
sbatch program internally reads the
2020-10-07 18:34:08 +02:00
.CW /etc/slurm/slurm.conf
file from outside the sandbox, so we must explicitly allow this file to
2020-10-13 12:13:56 +02:00
be available, as well as the
2020-10-07 18:34:08 +02:00
.I munge
2020-10-13 12:13:56 +02:00
socket used for authentication by the SLURM daemon. Once the jobs are
submitted to SLURM, the experiment stage ends and the trebuchet finishes
the execution. The jobs will be queued for execution without any other
intervention from the user.
2020-10-07 18:34:08 +02:00
.PP
2020-10-13 12:13:56 +02:00
The rationale behind running sbatch from the sandbox is because the
options provided in environment variables override the options from the
job script. Therefore, we avoid this problem by running sbatch from the
sandbox, where the interfering environment variables are removed. The
sbatch program is also provided in the
.I "nix store" ,
with a version compatible with the SLURM daemon running in the target
2020-11-06 12:31:31 +01:00
machine.
2020-10-07 18:34:08 +02:00
.NH 2
2020-10-13 12:13:56 +02:00
Job execution
2020-10-07 18:34:08 +02:00
.LP
2020-10-13 12:13:56 +02:00
Once an unit job has been selected for execution, SLURM
allocates the resources (usually several nodes) and then selects one of
the nodes to run the job script: it is not executed in parallel yet.
The job script runs from a child process forked from on of the SLURM
daemon processes, which are outside the sandbox. Therefore, we first run the
2020-10-07 18:34:08 +02:00
.I isolate
stage
to enter the sandbox again.
.PP
The next stage is called
.I control
2020-10-13 12:13:56 +02:00
and determines if enough data has been generated by the experiment unit
or if it should continue repeating the execution. At the current time,
it is only implemented as a simple loop that runs the next stage a fixed
amount of times (by default, it is repeated 30 times).
2020-10-07 18:34:08 +02:00
.PP
The following stage is
.I srun
2020-10-13 12:13:56 +02:00
which launches several copies of the next stage to run in
2020-10-07 18:34:08 +02:00
parallel (when using more than one task). Runs one copy per task,
2020-10-13 12:13:56 +02:00
effectively creating one process per task. The CPUs affinity is
configured by the parameter
2020-10-07 18:34:08 +02:00
.I --cpu-bind
2020-10-13 12:13:56 +02:00
and is important to set it correctly (see more details in the
2020-10-07 18:34:08 +02:00
.I srun(1)
2020-10-13 12:13:56 +02:00
manual). Appending the
2020-10-07 18:34:08 +02:00
.I verbose
value to the cpu bind option causes srun to print the assigned affinity
2020-10-13 12:13:56 +02:00
of each task, which is very valuable when examining the execution log.
2020-10-07 18:34:08 +02:00
.PP
The mechanism by which srun executes multiple processes is the same used
by sbatch, it forks from a SLURM daemon running in the computing nodes.
Therefore, the execution begins outside the sandbox. The next stage is
.I isolate
2020-10-13 12:13:56 +02:00
which enters again the sandbox in every task. All remaining stages are
running now in parallel.
.\" ###################################################################
.NH 2
The program
.LP
At this point in the execution, the standard pipeline has been
completely executed, and we are ready to run the actual program that is
the matter of the experiment. Usually, programs require some arguments
to be passed in the command line. The
.I exec
stage sets the arguments (and optionally some environment variables) and
2020-10-07 18:34:08 +02:00
executes the last stage, the
.I program .
2020-10-13 12:13:56 +02:00
.PP
The experimenters are required to define these last stages, as they
define the specific way in which the program must be executed.
Additional stages may be included before or after the program run, so
they can perform additional steps.
.\" ###################################################################
2020-10-07 18:34:08 +02:00
.NH 2
Stage overview
.LP
2020-10-13 12:13:56 +02:00
The complete execution pipeline using the standard pipeline is shown in
the Table 1. Some properties are also reflected about the execution
stages.
2020-10-07 18:34:08 +02:00
.KF
.TS
center;
2020-10-13 12:13:56 +02:00
lB cB cB cB cB cB
l c c c c c.
_
Stage Target Safe Copies User Std
_
trebuchet xeon no no yes yes
2020-10-13 14:07:34 +02:00
runexp login no no yes yes
isolate login no no no yes
2020-10-13 12:13:56 +02:00
experiment login yes no no yes
unit login yes no no yes
sbatch login yes no no yes
2020-10-07 18:34:08 +02:00
_
2020-10-13 12:13:56 +02:00
isolate comp no no no yes
control comp yes no no yes
srun comp yes no no yes
isolate comp no yes no yes
2020-10-07 18:34:08 +02:00
_
2020-10-13 12:13:56 +02:00
exec comp yes yes no no
program comp yes yes no no
2020-10-07 18:34:08 +02:00
_
.TE
2020-10-13 12:13:56 +02:00
.QS
2020-10-07 18:34:08 +02:00
.B "Table 1" :
2020-10-13 12:13:56 +02:00
The stages of a complete execution pipeline. The
2020-10-07 18:34:08 +02:00
.B target
2020-10-13 12:13:56 +02:00
column determines where the stage is running,
2020-10-07 18:34:08 +02:00
.B safe
2020-10-13 12:13:56 +02:00
states if the stage begins the execution inside the sandbox,
.B user
if it can be executed directly by the user,
2020-10-07 18:34:08 +02:00
.B copies
2020-10-13 12:13:56 +02:00
if there are several instances running in parallel and
.B std
if is part of the standard execution pipeline.
2020-10-07 18:34:08 +02:00
.QE
.KE