Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
M
MPI_Distributed_Programming
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
saad.aswad
MPI_Distributed_Programming
Commits
4d7eb207
You need to sign in or sign up before continuing.
Commit
4d7eb207
authored
Jan 04, 2026
by
saad.aswad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[P1] Add skeleton for prefix sum
parent
abe13aec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
prefix_sum.py
src/problem1/prefix_sum.py
+36
-0
No files found.
src/problem1/prefix_sum.py
0 → 100644
View file @
4d7eb207
# problem1/prefix_sum.py
from
mpi4py
import
MPI
import
sys
import
os
# Add common directory to path to import utils
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
))
from
common
import
utils
def
prefix_mpi
(
local_data
,
comm
):
"""
Computes distributed prefix sum.
Step 1: Local Prefix Sum
Step 2: Exchange Block Sums (Sequential on Rank 0 usually, or Allgather)
Step 3: Add offsets
"""
# Step 1: Local Prefix Sum
local_prefix
=
[]
# Placeholder
# Step 2: Block sums
# Step 3: Add offsets
return
local_prefix
def
main
():
comm
=
MPI
.
COMM_WORLD
rank
=
comm
.
Get_rank
()
size
=
comm
.
Get_size
()
# Placeholder for logic
if
rank
==
0
:
print
(
f
"Running Prefix Sum with {size} processes"
)
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment