Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Show more breadcrumbs
Core Modules
dune-common
Commits
f00cb61f
Commit
f00cb61f
authored
13 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Finished gather/scatter.
[[Imported from SVN: r6493]]
parent
7a3a5456
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/collectivecommunication.hh
+30
-3
30 additions, 3 deletions
dune/common/collectivecommunication.hh
dune/common/mpicollectivecommunication.hh
+9
-0
9 additions, 0 deletions
dune/common/mpicollectivecommunication.hh
with
39 additions
and
3 deletions
dune/common/collectivecommunication.hh
+
30
−
3
View file @
f00cb61f
...
...
@@ -168,9 +168,16 @@ namespace Dune
return
0
;
}
/** @brief Each process sends its in array of length len to the root process
(including the root itself). In the root process these arrays are stored in rank
order in the out array which must have size len * number of processes.
/** @brief Gather arrays on root task.
*
* Each process sends its in array of length len to the root process
* (including the root itself). In the root process these arrays are stored in rank
* order in the out array which must have size len * number of processes.
* @param[in] in The send buffer with the data to send.
* @param[out] out The buffer to store the received data in. Might have length zero on non-root
* tasks.
* @param[in] len The number of elements to send on each task.
* @param[out] root The root task that gathers the data.
*/
template
<
typename
T
>
int
gather
(
T
*
in
,
T
*
out
,
int
len
,
int
root
)
const
// note out must have same size as in
...
...
@@ -180,6 +187,26 @@ namespace Dune
return
0
;
}
/** @brief Scatter array from a root to all other task.
*
* The root process sends the elements with index from k*len to (k+1)*len-1 in its array to
* task k, which stores it at index 0 to len-1.
* @param[in] send The array to scatter. Might have length zero on non-root
* tasks.
* @param[out] recv The buffer to store the received data in. Upon completion of the
* method each task will have same data stored there as the one in
* send buffer of the root task before.
* @param[in] len The number of elements in the recv buffer.
* @param[out] root The root task that gathers the data.
*/
template
<
typename
T
>
int
scatter
(
T
*
send
,
T
*
recv
,
int
len
,
int
root
)
const
// note out must have same size as in
{
for
(
int
i
=
0
;
i
<
len
;
i
++
)
recv
[
i
]
=
send
[
i
];
return
0
;
}
/**
* @brief Gathers data from all tasks and distribute it to all.
*
...
...
This diff is collapsed.
Click to expand it.
dune/common/mpicollectivecommunication.hh
+
9
−
0
View file @
f00cb61f
...
...
@@ -309,6 +309,15 @@ namespace Dune
root
,
communicator
);
}
//! @copydoc CollectiveCommunication::gather()
template
<
typename
T
>
int
scatter
(
T
*
send
,
T
*
recv
,
int
len
,
int
root
)
const
// note out must have space for P*len elements
{
return
MPI_Scatter
(
send
,
len
,
MPITraits
<
T
>::
getType
(),
recv
,
len
,
MPITraits
<
T
>::
getType
(),
root
,
communicator
);
}
operator
MPI_Comm
()
const
{
return
communicator
;
...
...
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