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] Solution 3 : Pass Data (non-blocking point-to-point communication)

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


Task

Implement an MPI program in which a single integer is passed around all processes using non-blocking point-to-point communication.

That is, the process with rank zero assigns the initial value to the integer. It then passes the integer to the process with rank one.

This process, in turn, passes the integer to the process with rank two.

This continues until the process with rank \((p - 1)\), with \(p\) the number of processes. This last process passes the integer back to the process with rank zero.

Finally, the process with rank zero prints the integer to the terminal and the program ends.

Test the program with one and more processes.

Hints

Use the functions MPI_Isend, MPI_Irecv, and MPI_Wait to pass the integer from one process to the next.

Use the function MPI_Comm_rank to determine from which process the integer is to be received, and to which process the integer is to be sent.

Use the function MPI_Comm_size to determine the total number of processes.


Câu hỏi 1: Pass Data
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.