c:mpi:ring-algorithm
Differences
This shows you the differences between two versions of the page.
c:mpi:ring-algorithm [2024/01/17 10:53] – created odefta | c:mpi:ring-algorithm [2024/01/17 10:54] (current) – odefta | ||
---|---|---|---|
Line 51: | Line 51: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | **Initialization**: | ||
+ | |||
+ | **Determining Next and Previous Rank**: Each process calculates the rank of the next and previous process in the ring. | ||
+ | |||
+ | **Ring Communication**: | ||
+ | The first process (rank 0) initializes the token (here, with a value of -1) and sends it to the next process. | ||
+ | Each subsequent process receives the token from the previous process, increments its value, and sends it to the next process. \\ | ||
+ | The first process completes the ring by receiving the token from the last process. | ||
+ | |||
+ | **Output**: Each process prints a message when it receives the token, showing its current value and the rank of the process that sent it. | ||
+ | |||
+ | **Finalization**: | ||
+ | |||
+ | This program forms a simple ring where each process communicates with its immediate neighbor, and the token travels around the ring. | ||
c/mpi/ring-algorithm.1705481611.txt.gz · Last modified: 2024/01/17 10:53 by odefta