README.md 2.89 KB
Newer Older
Philip Carns's avatar
Philip Carns committed
1
# Mochi Boot Camp Session 3: SSG
2

Shane Snyder's avatar
Shane Snyder committed
3
4
TODO: overview presentation

Shane Snyder's avatar
Shane Snyder committed
5
6
7
8
9
10
11
12
Please refer back to documentation from
[Session 2: Hands-on](sessions/s2-hands-on/README.md) for general details on
logging onto JLSE, installing Mochi software, and running jobs. We will build
on your Spack environment from that session, additionally installing SSG before
attempting to run and modify an SSG example.

## Installing SSG

Shane Snyder's avatar
Shane Snyder committed
13
Run the following to download, compile, and install SSG:
Shane Snyder's avatar
Shane Snyder committed
14
15

```
Shane Snyder's avatar
Shane Snyder committed
16
spack install ssg
Shane Snyder's avatar
Shane Snyder committed
17
18
19
20
21
22
23
24
```

Note that this SSG installation depends on MPI, with Spack able to identify
an existing mpich installation on the system.

To load the SSG module, run the following:

```
Shane Snyder's avatar
Shane Snyder committed
25
26
27
28
29
30
31
32
spack load -r ssg
```

... and again inspect to confirm SSG, Margo, etc. modules have been loaded in
your environment with:

```
module list
Shane Snyder's avatar
Shane Snyder committed
33
34
```

Shane Snyder's avatar
Shane Snyder committed
35
36
## Building and running the SSG example

Shane Snyder's avatar
Shane Snyder committed
37
38
39
40
41
42
43
44
As an example demonstration of SSG, we have developed a simple token ring
application. In this example, a group of processes is excecuted using MPI,
with the MPI communicator used to create an SSG group. Using group rank
information, a token is passed around the ring, originating and ending at
rank 0. After each rank receives the forwarded token, it shuts down.

To build this example, run the following:

Shane Snyder's avatar
Shane Snyder committed
45
46
47
48
49
```
cd ~/bootcamp/mochi-boot-camp/sessions/s3-ssg/token-ring
make
```

Shane Snyder's avatar
Shane Snyder committed
50
51
52
53
54
55
56
57
58
59
60
61
62
Note that this builds 2 different executables: `ssg-token-ring1` and
`ssg-token-ring2`. `ssg-token-ring1` implements the token ring functionality
exactly as we have described so far: a single token is sent forward through the
ring, originating and ending at rank 0, with ranks shutting down on receipt
of the token (i.e., rank 1 shuts down first, rank 0 shuts down last).

Using your test system, try executing the example to confirm the behavior:

```
example output
```

## Modifying the SSG example
Shane Snyder's avatar
Shane Snyder committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

Once comfortable with the initial token ring implementation, we will
attempt to modify its behavior. Rather than having all ranks shutdown
immediately on receiving the token, we will instead have rank 0 initiate
shutdowns in  reverse-order through the ring once it receives the token. So,
assuming 4 members, once rank 0 receives the initial token, it will tell rank 3
to shutdown, who will tell rank 2 to shutdown, etc., with rank 0 shutting down
last. This requires definition of a new Margo RPC as well as some additional
logic in the existing token forwarding RPC handlers.

Executable `ssg-token-ring2` fully implements this new functionality, which can
be confirmed by executing:

```
example output
```

As an exercise, try extending the initial token ring example to account for this
new functionality by directly modifying `ssg-token-ring1.c` and
re-building/re-running. The source code contains `XXX` markers to help point
participants to the right locations in the code to modify. Participants are also
welcome to examine the `ssg-token-ring2.c` source directly for inspiration.

Let us know if you have any questions!