Thông tin

Tác giả Erik-Jan Lingen, Matthias Möller
Hạn chót Không có hạn chót
Giới hạn nộp bài Không có giới hạn

Đăng nhập

[MPI] Exercise 7 : Game

This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.


Task

Implement a game in which two groups of processes compete with each other by drawing random numbers.

The game proceeds in \(N\) rounds in which the two groups of processes generate a random number. The group with the largest number wins that round.

To generate a number per group, all processes in that group generate a random number independently. The largest number across all processes in the group is compared with the random number generated in a similar way by the other group.

The process with rank zero (within MPI_COMM_WORLD) should keep track of the number of wins for each group.

Hints

Use the provided function next_random to generate the stream of random numbers.

Test the program with 2, 3, 4, 5, 6, 7 and 8 processes. Do the results match your expectations?

Note that this exercise is not so much about performance but about correctness.


Câu hỏi 1: Game
Câu hỏi 2: Number of MPI processes

Specify the number of MPI processes (1-64) that should be used for running your program (mpirun -np <nproc>)

Câu hỏi 3: Command Line Argument

Specify the command line arguments that should be passed to your program when it is run. Arguments must be given in quotes and separated by commas. Leave this filed empty if you do not want to specify command line arguments.

Example: "1","int","arg=2" is interpreted as three arguments 1, int, and arg=2.