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
df98f5b1
Commit
df98f5b1
authored
8 years ago
by
Paul Heinzlreiter
Browse files
Options
Downloads
Patches
Plain Diff
* debugging
parent
b3a0ed7b
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/main.cpp
+62
-17
62 additions, 17 deletions
bh_tree_mpi/main.cpp
with
62 additions
and
17 deletions
bh_tree_mpi/main.cpp
+
62
−
17
View file @
df98f5b1
...
...
@@ -6,27 +6,72 @@ using namespace nbody;
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
BarnesHutTree
tree
;
MpiSimulation
simulation
(
argc
,
argv
);
if
(
argc
==
2
)
{
vector
<
Body
>
bodies
=
Tree
::
dubinskiParse
(
argv
[
1
]);
MpiSimulation
simulation
(
argc
,
argv
);
MpiBodyComm
comm
;
vector
<
Body
>
bodies
;
/*
if (simulation.getProcessId() == 0) {
bodies = Tree::dubinskiParse(argv[1]);
comm.sendBlocking(1, bodies);
} else {
comm.recvBlocking(0, bodies);
}
*/
MPI
::
Datatype
Btype
;
MPI
::
Datatype
type
[
3
]
=
{
MPI
::
DOUBLE
,
MPI
::
DOUBLE
,
MPI
::
DOUBLE
};
int
blocks
[
3
]
=
{
3
,
3
,
1
};
MPI
::
Aint
disp
[
3
];
if
(
simulation
.
getProcessId
()
==
0
)
{
bodies
=
Tree
::
dubinskiParse
(
argv
[
1
]);
}
else
{
bodies
.
reserve
(
128
);
}
disp
[
0
]
=
MPI
::
Get_address
(
bodies
[
0
].
position
);
disp
[
1
]
=
MPI
::
Get_address
(
bodies
[
0
].
velocity
);
disp
[
2
]
=
MPI
::
Get_address
(
&
bodies
[
0
].
mass
);
Btype
=
Btype
.
Create_struct
(
3
,
blocks
,
disp
,
type
);
Btype
.
Commit
();
//MPI::COMM_WORLD.Bcast(MPI::BOTTOM, 128, Btype, 0);
cout
<<
bodies
.
size
()
<<
endl
;
tree
.
build
(
bodies
);
if
(
!
tree
.
isCorrect
())
{
cout
<<
"Tree not correct"
<<
endl
;
return
-
1
;
if
(
simulation
.
getProcessId
()
==
0
)
{
MPI
::
COMM_WORLD
.
Send
(
MPI
::
BOTTOM
,
128
,
Btype
,
1
,
0
);
}
else
if
(
simulation
.
getProcessId
()
==
1
)
{
MPI
::
COMM_WORLD
.
Recv
(
MPI
::
BOTTOM
,
128
,
Btype
,
0
,
0
);
}
tree
.
print
();
tree
.
computeForces
();
tree
.
moveBodies
();
tree
.
rebuildTree
();
if
(
!
tree
.
isCorrect
())
{
cout
<<
"Tree not correct"
<<
endl
;
return
-
1
;
Btype
.
Free
();
/*
if (simulation.getProcessId() == 0) {
BarnesHutTree tree;
vector<Body> bodies = Tree::dubinskiParse(argv[1]);
cout << bodies.size() << endl;
tree.build(bodies);
if (!tree.isCorrect()) {
cout << "Tree not correct" << endl;
return -1;
}
tree.print();
tree.computeForces();
tree.moveBodies();
tree.rebuildTree();
if (!tree.isCorrect()) {
cout << "Tree not correct" << endl;
return -1;
}
tree.print();
comm.sendBlocking(1, bodies);
} else if (simulation.getProcessId() == 1) {
vector<Body> recved;
comm.recvBlocking(0, recved);
}
tree
.
print
();
*/
}
else
{
std
::
cout
<<
"You need to specify the body input file."
<<
endl
;
}
...
...
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