Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
livecode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ma4261_2002
livecode
Commits
34770493
Commit
34770493
authored
5 years ago
by
Jeremy Edward Kozdon
Browse files
Options
Downloads
Patches
Plain Diff
Finish comm pattern
parent
7c5bbcb8
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
topic03/convolution.jl
+56
-11
56 additions, 11 deletions
topic03/convolution.jl
with
56 additions
and
11 deletions
topic03/convolution.jl
+
56
−
11
View file @
34770493
...
...
@@ -190,23 +190,20 @@ function exchangedata!(A, xrng, yrng, mpicomm, Rx, Ry, Sx, Sy)
recvreqs
=
fill
(
MPI
.
REQUEST_NULL
,
8
)
# possible neighbors:
#
S
outhwest: (Rx-1, Ry-1)
#
s
outhwest: (Rx-1, Ry-1)
if
Rx
>
0
&&
Ry
>
0
# Convert neighbors Cartesian index
(Rx-1, Ry-1)
to the MPI linear index
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
-
1
)
+
(
Ry
-
1
)
*
Sx
recvdata
=
@view
A
[
1
:
2
,
1
:
2
]
senddata
=
@view
A
[
3
:
4
,
3
:
4
]
# recv data: (1:2, 1:2)
recvreqs
[
1
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
# send data: (3:4, 3:4)
sendreqs
[
1
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
# south : (Rx , Ry-1)
if
Ry
>
0
# Convert neighbors Cartesian index
(Rx, Ry-1)
to the MPI linear index
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
)
+
(
Ry
-
1
)
*
Sx
recvdata
=
@view
A
[
xrng
,
1
:
2
]
...
...
@@ -215,24 +212,72 @@ function exchangedata!(A, xrng, yrng, mpicomm, Rx, Ry, Sx, Sy)
recvreqs
[
2
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
sendreqs
[
2
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
#
S
outheast: (Rx+1, Ry-1)
if
R
y
>
0
&&
R
x
+
1
<
Sx
# Convert neighbors Cartesian index
(Rx+1, Ry-1)
to the MPI linear index
#
s
outheast: (Rx+1, Ry-1)
if
Rx
+
1
<
Sx
&&
Ry
>
0
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
+
1
)
+
(
Ry
-
1
)
*
Sx
# last two values of halo recv
recvdata
=
@view
A
[
end
-
1
:
end
,
1
:
2
]
# last two values of real data send
senddata
=
@view
A
[
xrng
[
end
-
1
:
end
],
3
:
4
]
recvreqs
[
3
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
sendreqs
[
3
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
# west : (Rx-1, Ry )
if
Rx
>
0
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
-
1
)
+
(
Ry
)
*
Sx
recvdata
=
@view
A
[
1
:
2
,
yrng
]
senddata
=
@view
A
[
3
:
4
,
yrng
]
recvreqs
[
4
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
sendreqs
[
4
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
# east : (Rx+1, Ry )
if
Rx
+
1
<
Sx
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
+
1
)
+
(
Ry
)
*
Sx
recvdata
=
@view
A
[
end
-
1
:
end
,
yrng
]
senddata
=
@view
A
[
xrng
[
end
-
1
:
end
],
yrng
]
recvreqs
[
5
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
sendreqs
[
5
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
# northwest: (Rx-1, Ry+1)
if
Rx
>
0
&&
Ry
+
1
<
Sy
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
-
1
)
+
(
Ry
+
1
)
*
Sx
recvdata
=
@view
A
[
1
:
2
,
end
-
1
:
end
]
senddata
=
@view
A
[
3
:
4
,
yrng
[
end
-
1
:
end
]]
recvreqs
[
6
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
sendreqs
[
6
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
# north : (Rx , Ry+1)
if
Ry
+
1
<
Sy
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
)
+
(
Ry
+
1
)
*
Sx
recvdata
=
@view
A
[
xrng
,
end
-
1
:
end
]
senddata
=
@view
A
[
xrng
,
yrng
[
end
-
1
:
end
]]
recvreqs
[
7
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
sendreqs
[
7
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
# northeast: (Rx+1, Ry+1)
if
Rx
+
1
<
Sx
&&
Ry
+
1
<
Sy
# Convert neighbors Cartesian index to the MPI linear index
neigh_rank
=
(
Rx
+
1
)
+
(
Ry
+
1
)
*
Sx
recvdata
=
@view
A
[
end
-
1
:
end
,
end
-
1
:
end
]
senddata
=
@view
A
[
xrng
[
end
-
1
:
end
],
yrng
[
end
-
1
:
end
]]
recvreqs
[
8
]
=
MPI
.
Irecv!
(
recvdata
,
neigh_rank
,
0
,
mpicomm
)
sendreqs
[
8
]
=
MPI
.
Isend
(
senddata
,
neigh_rank
,
0
,
mpicomm
)
end
MPI
.
Waitall!
(
recvreqs
)
MPI
.
Waitall!
(
sendreqs
)
...
...
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