Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
n-body_methods
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
CodeVault
hpc-kernels
n-body_methods
Commits
cbeebf9d
Commit
cbeebf9d
authored
8 years ago
by
Paul Heinzlreiter
Browse files
Options
Downloads
Patches
Plain Diff
* mpi communictaion testing
parent
13ae570d
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bh_tree_mpi/mpitest.cpp
+15
-12
15 additions, 12 deletions
bh_tree_mpi/mpitest.cpp
with
15 additions
and
12 deletions
bh_tree_mpi/mpitest.cpp
+
15
−
12
View file @
cbeebf9d
...
...
@@ -31,22 +31,25 @@ int main(int argc, char** argv) {
restype
=
restype
.
Create_struct
(
3
,
blocklengths
,
displacements
,
datatypes
);
restype
.
Commit
();
A
a
;
A
a
[
4
]
;
if
(
MPI
::
COMM_WORLD
.
Get_rank
()
==
0
)
{
a
.
num
=
1
;
a
.
x
=
2.0
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
a
.
data
[
i
]
=
a
.
x
+
1
+
i
;
for
(
int
j
=
0
;
j
<
4
;
j
++
)
{
a
[
j
].
num
=
j
*
10.0
+
1
;
a
[
j
].
x
=
j
*
10.0
+
2.0
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
a
[
j
].
data
[
i
]
=
j
*
10.0
+
a
[
j
].
x
+
1
+
i
;
}
}
MPI
::
COMM_WORLD
.
Send
(
&
a
,
1
,
restype
,
1
,
0
);
MPI
::
COMM_WORLD
.
Send
(
&
a
[
0
],
4
,
restype
,
1
,
0
);
}
else
if
(
MPI
::
COMM_WORLD
.
Get_rank
()
==
1
)
{
MPI
::
COMM_WORLD
.
Recv
(
&
a
,
1
,
restype
,
0
,
0
);
cout
<<
a
.
num
<<
" "
<<
a
.
x
<<
" "
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
cout
<<
a
.
data
[
i
]
<<
" "
;
MPI
::
COMM_WORLD
.
Recv
(
&
a
[
0
],
4
,
restype
,
0
,
0
);
for
(
int
j
=
0
;
j
<
4
;
j
++
)
{
cout
<<
a
[
j
].
num
<<
" "
<<
a
[
j
].
x
<<
" "
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
cout
<<
a
[
j
].
data
[
i
]
<<
" "
;
}
cout
<<
endl
;
}
cout
<<
endl
;
}
MPI
::
Finalize
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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