c:mpi:ring-algorithm
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| c:mpi:ring-algorithm [2024/01/17 08:53] – created odefta | c:mpi:ring-algorithm [2025/01/02 18:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| 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: (external edit)
