From 502073282bfa50b9aa8a451360d585bc2566acbe Mon Sep 17 00:00:00 2001 From: Kaleb Phipps <kaleb.phipps@kit.edu> Date: Tue, 3 Dec 2024 13:11:23 +0100 Subject: [PATCH] fix comment --- 2_psrs_cdist/solutions/A1/cdist_symmetric.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/2_psrs_cdist/solutions/A1/cdist_symmetric.py b/2_psrs_cdist/solutions/A1/cdist_symmetric.py index 1c60615..af24da8 100644 --- a/2_psrs_cdist/solutions/A1/cdist_symmetric.py +++ b/2_psrs_cdist/solutions/A1/cdist_symmetric.py @@ -63,9 +63,10 @@ def dist_symmetric(x: torch.Tensor, y: torch.Tensor, comm: MPI.Comm = MPI.COMM_W # --- Ring Communication Pattern --- # Calculate distances in a "ring" pattern. Each process calculates distances for its local x chunk against its - # local y chunk (diagonal calculation). Then, through `size - 1` iterations, each process sends its y chunk to - # the next process in the "ring" while receiving a new y chunk from the previous process. This continues until - # each process has calculated distances between its x chunk and all chunks of y across all processes. + # local y chunk (diagonal calculation). Then, through `(size + 1) // 2` iterations, each process sends its y + # chunk to the next process in the "ring" while receiving a new y chunk from the previous process. This + # continues until each process has calculated distances between its x chunk and all chunks of y across all + # processes. x_ = x stationary = y @@ -76,7 +77,7 @@ def dist_symmetric(x: torch.Tensor, y: torch.Tensor, comm: MPI.Comm = MPI.COMM_W local_distances[:, cols[0]: cols[1]] = d_ij print(f"Rank [{rank}/{size}]: Start tile-wise ring communication...") - # Remaining `(size+1) // 2` iterations: Send rank-local part of y to next process in circular fashion. + # Remaining `(size + 1) // 2` iterations: Send rank-local part of y to next process in circular fashion. # We can perform less iterations due to the symmetric nature of the metric. for iter_idx in range(1, (size + 2) // 2): print(f"Rank [{rank}/{size}]: Starting iteration {iter_idx}") -- GitLab