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
be888bca
Commit
be888bca
authored
8 years ago
by
Paul Heinzlreiter
Browse files
Options
Downloads
Patches
Plain Diff
* fixed mpi struct declaration
parent
5234048c
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/parallelization/MpiSimulation.cpp
+10
-39
10 additions, 39 deletions
bh_tree_mpi/parallelization/MpiSimulation.cpp
with
10 additions
and
39 deletions
bh_tree_mpi/parallelization/MpiSimulation.cpp
+
10
−
39
View file @
be888bca
...
...
@@ -3,48 +3,19 @@
namespace
nbody
{
MpiSimulation
::
MpiSimulation
(
int
&
argc
,
char
**&
argv
)
{
MPI
::
Aint
displacements
[
3
];
int
blocklengths
[
3
];
MPI
::
Datatype
types
[
5
]
=
{
MPI
::
LB
,
MPI
::
DOUBLE
,
MPI
::
DOUBLE
,
MPI
::
DOUBLE
,
MPI
::
UB
};
int
blocklengths
[
5
]
=
{
1
,
3
,
3
,
1
,
1
};
MPI
::
Aint
displacements
[
5
];
Body
example
;
MPI
::
Init
(
argc
,
argv
);
displacements
[
0
]
=
(
MPI
::
Aint
)
((
MPI
::
Aint
)
(
&
example
)
-
(
MPI
::
Aint
)
(
&
example
.
position
[
0
]));
displacements
[
1
]
=
(
MPI
::
Aint
)
((
MPI
::
Aint
)
(
&
example
)
-
(
MPI
::
Aint
)
(
&
example
.
velocity
[
0
]));
displacements
[
2
]
=
(
MPI
::
Aint
)
((
MPI
::
Aint
)
(
&
example
)
-
(
MPI
::
Aint
)
(
&
example
.
mass
));
blocklengths
[
0
]
=
3
;
blocklengths
[
1
]
=
3
;
blocklengths
[
2
]
=
1
;
this
->
mpiBody
=
MPI
::
Datatype
(
MPI
::
DOUBLE
);
//this->mpiBody.Create_hindexed(3, blocklengths, displacements);
//this->mpiBody.Create_hindexed(1, &blocklengths[2], &displacements[0]);
mpiBody
.
Commit
();
/*
MPI::Datatype datatypes[4] = {MPI::DOUBLE, MPI::DOUBLE, MPI::DOUBLE, MPI::UB};
MPI::Aint displacements[4];
int blocklengths[4] = {3, 3, 1, 1};
MPI::Aint lb;
MPI::Aint extent;
Body example;
MPI::Init(argc, argv);
MPI::DOUBLE.Get_extent(lb, extent);
displacements[0] = (MPI::Aint) (&example.position[0] - &example.position[0]);
displacements[1] = (MPI::Aint) (&example.velocity[0] - &example.position[0]);
displacements[2] = (MPI::Aint) (&example.mass - &example.position[0]);
displacements[3] = (MPI::Aint) sizeof(Body);
mpiBody.Create_struct(4, blocklengths, displacements, datatypes);
mpiBody.Commit();
this->mpiSize = MPI::COMM_WORLD.Get_size();
this->mpiRank = MPI::COMM_WORLD.Get_rank();
*/
/*
double position[3];
double velocity[3];
double acceleration[3];
double mass;
bool refinement;
*/
displacements
[
0
]
=
MPI
::
Get_address
(
&
example
);
displacements
[
1
]
=
MPI
::
Get_address
(
&
example
.
position
[
0
]);
displacements
[
2
]
=
MPI
::
Get_address
(
&
example
.
acceleration
[
0
]);
displacements
[
3
]
=
MPI
::
Get_address
(
&
example
.
mass
);
displacements
[
4
]
=
MPI
::
Get_address
(
&
example
+
sizeof
(
Body
));
this
->
mpiBody
=
this
->
mpiBody
.
Create_struct
(
5
,
blocklengths
,
displacements
,
types
);
this
->
mpiBody
.
Commit
();
this
->
mpiSize
=
MPI
::
COMM_WORLD
.
Get_size
();
this
->
mpiRank
=
MPI
::
COMM_WORLD
.
Get_rank
();
}
...
...
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