*Wireworld* is a simple cellular automaton, similar to the Game of Life. The game area is a 2-dimensional rectangle of cells. Each generation a set of rules are applied which define the next state of the cell depending on the neighboring cells.
For a general description of *Wireworld* and the file format, see the `README.md` file in the parent directory.
This example shows how to distribute the simulation of Wireworld across multiple compute nodes. This includes Parallel IO for the input/output files and parallel computation of the next generation.localized.
The computation is distributed by spatially splitting the Wireworld rectangle into smaller chunks (*Tiles*). Where each compute node has one tile. At the border of each tile, there has to be communication with the neighboring tiles (**Halo Exchange**)
This code sample demonstrates:
This code sample demonstrates:
* Using **Collective IO** MPI functions for efficiently reading and writing from multiple nodes to the same File, i.e. `MPI_File_set_view`, `MPI_File_read_all`
* Using **Collective IO** MPI functions for efficiently reading and writing from multiple nodes to the same File, i.e. `MPI_File_set_view`, `MPI_File_read_all`
...
@@ -27,19 +23,7 @@ The code sample is structured as follows:
...
@@ -27,19 +23,7 @@ The code sample is structured as follows:
*`MpiWireworld.*`: Simulating a generation step, computing next state
*`MpiWireworld.*`: Simulating a generation step, computing next state
*`Tile.*`: Represents a Tile, memory management, debugging
*`Tile.*`: Represents a Tile, memory management, debugging
File Format:
The Wireworld file format is a text format. The first line is the header. The header has 2 positive integers, separated by space, which define the number of *colums*(width) and the number of *rows*(height) of the Wireworld.
In the following lines, the wireworld data is provided.
Each line is a row.
There are exactly *rows* lines and each line is exactly *colums* long.
The following characters are allowed:
*` `: whitespace/empty
*`#`: conductor
*`@`: electron head
*`~`: electron tail
Note: Be aware that the line ending must match your operating systems convention.
## Release Date
## Release Date
...
@@ -84,19 +68,19 @@ Follow the compilation instructions given in the main directory of the kernel sa
...
@@ -84,19 +68,19 @@ Follow the compilation instructions given in the main directory of the kernel sa
either on the command line or in your batch script, where `g` specifies the number of iterations, `f` the inputfile, `o` the output file and `m` the communication mode.
either on the command line or in your batch script, where an inputfile must be provided.
### Command line arguments
### Command line arguments
*`-r [ --gridrows ]`: number of rows in the grid to form the tiles (optional, automatically deduced)
*`-x [ --nprocs-x ]`: number of processes in x-direction (optional, automatically deduced)
*`-c [ --gridcols ]`: number of columns in the grid to form the tiles (optional, automatically deduced)
*`-r [ --nprocs-y ]`: number of processes in y-direction (optional, automatically deduced)
*`-g [ --generations ]`: number of generations simulated (default 1000)
*`-g [ --generations ]`: number of generations simulated (default 1000)
*`-m [ --commmode ]`: Communication Mode. Collective or P2P (default Collective)
*`-m [ --commmode ]`: Communication Mode. `Collective` or `P2P` (default Collective)
*`-f [ --inputfile ]`: path to wireworld input file (mandatory, flag can be obmitted) The file dimension must be divisible by the *grid dimension.
*`-f [ --inputfile ]`: path to wireworld input file (mandatory, flag can be obmitted) The file dimension must be divisible by the *grid dimension.
*`-o [ --outputfile ]`: path to wireworld input file (optional, no writing)
*`-o [ --outputfile ]`: path to wireworld input file (optional)