Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalableAI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marie Weiel
ScalableAI
Commits
24ceb630
Commit
24ceb630
authored
3 months ago
by
Marie Weiel
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of
https://gitlab.kit.edu/marie.weiel/scalableai2425
parents
ea0f238e
64534acb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
2_psrs_cdist/solutions/A1/cdist_symmetric.py
+5
-4
5 additions, 4 deletions
2_psrs_cdist/solutions/A1/cdist_symmetric.py
with
5 additions
and
4 deletions
2_psrs_cdist/solutions/A1/cdist_symmetric.py
+
5
−
4
View file @
24ceb630
...
...
@@ -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
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment