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
eb13ba24
Commit
eb13ba24
authored
8 years ago
by
Paul Heinzlreiter
Browse files
Options
Downloads
Patches
Plain Diff
* merge LETs
parent
0f4e9b6f
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bh_tree_mpi/simulation/MpiSimulation.cpp
+3
-94
3 additions, 94 deletions
bh_tree_mpi/simulation/MpiSimulation.cpp
with
3 additions
and
94 deletions
bh_tree_mpi/simulation/MpiSimulation.cpp
+
3
−
94
View file @
eb13ba24
...
...
@@ -207,105 +207,14 @@ namespace nbody {
this
->
send
(
this
->
tree
->
copyRefinements
(
this
->
domains
[
i
]),
i
);
}
}
int
received
=
0
;
while
(
received
<
this
->
parallelSize
-
1
)
{
vector
<
Body
>
buffer
;
this
->
recv
(
buffer
,
MPI_ANY_SOURCE
);
//cout << "recved " + buffer.size() << endl;
//print(this->parallelRank, buffer);
received
++
;
}
/*
vector<vector<Body> > sendRefinements;
MPI_Request* sendRequests = new MPI_Request[this->parallelSize];
for (int i = 0; i < this->parallelSize; i++) {
if (i != this->parallelRank) {
sendRefinements.push_back(this->tree->copyRefinements(this->domains[i]));
MPI_Isend(&sendRefinements[i], (int) sendRefinements[i].size(), this->bodyType, i, 0, MPI_COMM_WORLD, &sendRequests[i]);
} else {
sendRefinements.push_back(vector<Body>());
}
}
int received = 0;
Body** data = new Body*[this->parallelSize];
MPI_Request* recvRequests = new MPI_Request[this->parallelSize];
for (int i = 0; i < this->parallelSize; i++) {
data[i] = NULL;
}
while (received < this->parallelSize - 1) {
for (int i = 0; i < this->parallelSize; i++) {
if (i != this->parallelRank && data[i] == NULL) {
int ready;
MPI_Status probeStatus;
MPI_Iprobe(i, 0, MPI_COMM_WORLD, &ready, &probeStatus);
if (ready) {
int count;
MPI_Status status;
MPI_Get_count(&probeStatus, this->bodyType, &count);
data[i] = new Body[count];
MPI_Irecv(&data[i][0], count, this->bodyType, i, 0, MPI_COMM_WORLD, &recvRequests[i]);
MPI_Wait(&recvRequests[i], &status);
cout << this->parallelRank << ": " << count << " from " << i << " received" << endl;
}
}
}
}
delete[] sendRequests;
delete[] recvRequests;
for (int i = 0; i < this->parallelSize; i++) {
delete[] data[i];
}
delete[] data;
*/
/*
int* lengths = new int[this->parallelSize];
for (int i = 0; i < this->parallelSize; i++) {
if (i != this->parallelRank) {
refinements.push_back(this->tree->copyRefinements(this->domains[i]));
} else {
refinements.push_back(vector<Body>());
}
lengths[i] = refinements.back().size();
}
MPI_Alltoall(lengths, 1, MPI_INT, lengths, 1, MPI_INT, MPI_COMM_WORLD);
for (int i = 0; i < this->parallelSize; i++) {
if (i != this->parallelRank) {
MPI_Send(&(refinements[i][0]), (int) refinements[i].size(), this->bodyType, i, 0, MPI_COMM_WORLD);
}
}
for (int i = 0; i < this->parallelSize; i++) {
if (i != this->parallelRank) {
MPI_Recv()
}
}
delete[] lengths;
*/
//receive bodies and integrate them into local tree for simulation
/*
int received = 0;
while (received < this->parallelSize - 1) {
for
(
int
i
=
0
;
i
<
this
->
parallelSize
-
1
;
i
++
)
{
vector
<
Body
>
refinements
;
//int source = this->recv(refinements);
//cout << "refR: " << this->parallelRank << " <- " << source << ": " << refinements.size() << endl;
//this->tree->mergeLET(refinements);
//integrate bodies in order of arrival to do communication/computation overlapping
this->comms[0].recvBlocking(MPI_ANY_SOURCE, refinements);
this
->
recv
(
refinements
,
MPI_ANY_SOURCE
);
this
->
tree
->
mergeLET
(
refinements
);
//this->tree.getRootBB().print();
received++;
}
*/
if
(
!
this
->
tree
->
isCorrect
())
{
cout
<<
"WRONG"
<<
endl
;
}
...
...
@@ -320,7 +229,7 @@ namespace nbody {
this->tree->build(this->bodies);
}
*/
this
->
tree
->
build
(
this
->
bodies
);
this
->
tree
->
build
(
this
->
bodies
,
this
->
overallDomain
);
if
(
!
this
->
tree
->
isCorrect
())
{
cout
<<
"wrong tree"
<<
endl
;
}
else
{
...
...
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