QosCosGrid MPI Lab
Prepare your environment
Please read the file located here for instructions.
Materials :
If you have never used MPI, you can find some small examples
here.
Now you are ready for the lab
This lab has been prepared with (and mainly by) Éric
Rodriguez
You can get Pierre's presentation here.
And here is the presentation I made as an introduction [PPT] [SXI].
MPI web
page that provides the standard and some documentation.
We provide you some files in this bundle
A Makefile ;-)
debug.c and debug.h are used to do some debug outputs
ant.h : declaration of the data structures, of some
constants, macros...
ant_tools.c and the corresponding ant_tools.h contain
some functions such as the transition rule (that defines how
the ants walk around).
pngant.c contains the functions to write the result as a
png picture, so that you can really see the result.
You also have to write some functions in some other provided
files
mpi_tools.c is the file where you write the communication
functions.
rebuild_solution(struct cell
*global_current_cellulae, struct cell *current_cellulae, int
my_width) gathers the partial results computed by every
process to the process with rank 0.
create_data_struct_mpi(void) is used to create
two new MPI data structures, called MPI_CELLULAE
and MPI_ANT_TRANSFERT.
ant.c is the main file where the iterations are
performed. This is where the main() function is
implemented. The function you have to write is the one that
manages the boundaries: boundary_treatment(void). We
have two issues at the boundaries :
When an ant looks around it, it requires a knowledge
about the state of the cells nearby. Then each process must
send the state of its eastest and westest collumns of cells
to its neighbours.
Some ants might walk across the boundaries and go
from one process to another.
In order to get an idea of the impact of your parallelisation on
the performances of the applications, you should include some time
measurements in your code, wherever you find it useful. Some are
already included, but of course you can add some.
If you need some debug outputs, use the debug(...)
function. You just need to include "ant.h" in you file (in the
files we provide you, it is already included), and use
it as printf. The only difference is that you don't have to add \n
at the end of your output, debug(..) does it for you.
We propose a solution here.
Camille Coti
Last modified: Tue Nov 21 14:32:35 CET 2006