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
a36ede17
Commit
a36ede17
authored
14 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Make Generic_MPI_Datatype deprecated in favor of MPI_Datatype.
[[Imported from SVN: r6269]]
parent
d501004f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/mpicollectivecommunication.hh
+9
-7
9 additions, 7 deletions
dune/common/mpicollectivecommunication.hh
dune/common/mpitraits.hh
+22
-2
22 additions, 2 deletions
dune/common/mpitraits.hh
with
31 additions
and
9 deletions
dune/common/mpicollectivecommunication.hh
+
9
−
7
View file @
a36ede17
...
...
@@ -13,10 +13,12 @@
#include
<algorithm>
#include
<functional>
#include
"deprecated.hh"
#include
"exceptions.hh"
#include
"collectivecommunication.hh"
#include
"binaryfunctions.hh"
#include
"shared_ptr.hh"
#include
"mpitraits.hh"
#if HAVE_MPI
// MPI header
...
...
@@ -24,6 +26,7 @@
namespace
Dune
{
//=======================================================
// use singleton pattern and template specialization to
// generate MPI data types
...
...
@@ -35,7 +38,7 @@ namespace Dune
class
Generic_MPI_Datatype
{
public:
static
MPI_Datatype
get
()
static
MPI_Datatype
get
()
DUNE_DEPRECATED
{
if
(
!
type
)
{
...
...
@@ -59,7 +62,7 @@ namespace Dune
template<> \
class Generic_MPI_Datatype<p>{ \
public: \
static inline MPI_Datatype get(){ \
static inline MPI_Datatype get()
DUNE_DEPRECATED
{ \
return m; \
} \
}
...
...
@@ -79,7 +82,6 @@ namespace Dune
#undef ComposeMPITraits
//=======================================================
// use singleton pattern and template specialization to
// generate MPI operations
...
...
@@ -295,15 +297,15 @@ namespace Dune
template
<
typename
T
>
int
broadcast
(
T
*
inout
,
int
len
,
int
root
)
const
{
return
MPI_Bcast
(
inout
,
len
,
Generic_MPI_Datatype
<
T
>::
get
(),
root
,
communicator
);
return
MPI_Bcast
(
inout
,
len
,
MPITraits
<
T
>::
get
Type
(),
root
,
communicator
);
}
//! @copydoc CollectiveCommunication::gather()
template
<
typename
T
>
int
gather
(
T
*
in
,
T
*
out
,
int
len
,
int
root
)
const
// note out must have space for P*len elements
{
return
MPI_Gather
(
in
,
len
,
Generic_MPI_Datatype
<
T
>::
get
(),
out
,
len
,
Generic_MPI_Datatype
<
T
>::
get
(),
return
MPI_Gather
(
in
,
len
,
MPITraits
<
T
>::
get
Type
(),
out
,
len
,
MPITraits
<
T
>::
get
Type
(),
root
,
communicator
);
}
...
...
@@ -325,7 +327,7 @@ namespace Dune
template
<
typename
BinaryFunction
,
typename
Type
>
int
allreduce
(
Type
*
in
,
Type
*
out
,
int
len
)
const
{
return
MPI_Allreduce
(
in
,
out
,
len
,
Generic_MPI_Datatype
<
Type
>::
get
(),
return
MPI_Allreduce
(
in
,
out
,
len
,
MPITraits
<
Type
>::
get
Type
(),
Generic_MPI_Op
<
Type
,
BinaryFunction
>::
get
(),
communicator
);
}
...
...
This diff is collapsed.
Click to expand it.
dune/common/mpitraits.hh
+
22
−
2
View file @
a36ede17
...
...
@@ -19,6 +19,8 @@ namespace Dune
* @brief Traits classes for mapping types onto MPI_Datatype.
* @author Markus Blatt
*/
#if HAVE_MPI
/**
* @brief A traits class describing the mapping of types onto MPI_Datatypes.
*
...
...
@@ -30,7 +32,25 @@ namespace Dune
*/
template
<
typename
T
>
struct
MPITraits
{};
{
private:
MPITraits
(){}
MPITraits
(
const
MPITraits
&
){}
static
MPI_Datatype
datatype
;
static
MPI_Datatype
vectortype
;
public
:
static
inline
MPI_Datatype
getType
()
{
if
(
datatype
==
MPI_DATATYPE_NULL
)
{
MPI_Type_contiguous
(
sizeof
(
T
),
MPI_BYTE
,
&
datatype
);
MPI_Type_commit
(
&
datatype
);
}
return
datatype
;
}
};
template
<
class
T
>
MPI_Datatype
MPITraits
<
T
>::
datatype
=
MPI_DATATYPE_NULL
;
#ifndef DOXYGEN
#if HAVE_MPI
...
...
@@ -169,7 +189,7 @@ namespace Dune
MPI_Datatype
MPITraits
<
std
::
pair
<
T1
,
T2
>
>::
type
=
MPI_DATATYPE_NULL
;
#endif
#endif
#endif
/** @} */
}
...
...
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