Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
21777e5a
Commit
21777e5a
authored
Oct 16, 2018
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Rename Messenger::Helper -> Messenger::helper
parent
23dfd571
No related branches found
No related tags found
1 merge request
!11
Feature/mpi
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/Messenger.hpp
+21
-25
21 additions, 25 deletions
src/utils/Messenger.hpp
with
21 additions
and
25 deletions
src/utils/Messenger.hpp
+
21
−
25
View file @
21777e5a
...
@@ -14,13 +14,10 @@
...
@@ -14,13 +14,10 @@
#include
<mpi.h>
#include
<mpi.h>
#endif // PASTIS_HAS_MPI
#endif // PASTIS_HAS_MPI
#warning REMOVE
enum
class
CellType
:
unsigned
short
;
class
Messenger
class
Messenger
{
{
private:
private:
struct
H
elper
struct
h
elper
{
{
#ifdef PASTIS_HAS_MPI
#ifdef PASTIS_HAS_MPI
template
<
typename
DataType
>
template
<
typename
DataType
>
...
@@ -39,7 +36,6 @@ class Messenger
...
@@ -39,7 +36,6 @@ class Messenger
}
}
#endif // PASTIS_HAS_MPI
#endif // PASTIS_HAS_MPI
private
:
private
:
template
<
typename
T
,
template
<
typename
T
,
typename
Allowed
=
void
>
typename
Allowed
=
void
>
...
@@ -107,7 +103,7 @@ class Messenger
...
@@ -107,7 +103,7 @@ class Messenger
const
int
count
=
sent_array
.
size
()
/
m_size
;
const
int
count
=
sent_array
.
size
()
/
m_size
;
MPI_Datatype
mpi_datatype
=
Messenger
::
H
elper
::
mpiType
<
SendDataType
>
();
MPI_Datatype
mpi_datatype
=
Messenger
::
h
elper
::
mpiType
<
SendDataType
>
();
MPI_Alltoall
(
&
(
sent_array
[
0
]),
count
,
mpi_datatype
,
MPI_Alltoall
(
&
(
sent_array
[
0
]),
count
,
mpi_datatype
,
&
(
recv_array
[
0
]),
count
,
mpi_datatype
,
&
(
recv_array
[
0
]),
count
,
mpi_datatype
,
...
@@ -132,7 +128,7 @@ class Messenger
...
@@ -132,7 +128,7 @@ class Messenger
#ifdef PASTIS_HAS_MPI
#ifdef PASTIS_HAS_MPI
std
::
vector
<
MPI_Request
>
request_list
;
std
::
vector
<
MPI_Request
>
request_list
;
MPI_Datatype
mpi_datatype
=
Messenger
::
H
elper
::
mpiType
<
SendDataType
>
();
MPI_Datatype
mpi_datatype
=
Messenger
::
h
elper
::
mpiType
<
SendDataType
>
();
for
(
size_t
i_send
=
0
;
i_send
<
sent_array_list
.
size
();
++
i_send
)
{
for
(
size_t
i_send
=
0
;
i_send
<
sent_array_list
.
size
();
++
i_send
)
{
const
SendArrayType
sent_array
=
sent_array_list
[
i_send
];
const
SendArrayType
sent_array
=
sent_array_list
[
i_send
];
...
@@ -232,7 +228,7 @@ class Messenger
...
@@ -232,7 +228,7 @@ class Messenger
if
constexpr
(
std
::
is_arithmetic_v
<
DataType
>
)
{
if
constexpr
(
std
::
is_arithmetic_v
<
DataType
>
)
{
_allToAll
(
sent_array
,
recv_array
);
_allToAll
(
sent_array
,
recv_array
);
}
else
if
constexpr
(
std
::
is_trivial_v
<
DataType
>
)
{
}
else
if
constexpr
(
std
::
is_trivial_v
<
DataType
>
)
{
using
CastType
=
H
elper
::
split_cast_t
<
DataType
>
;
using
CastType
=
h
elper
::
split_cast_t
<
DataType
>
;
auto
send_cast_array
=
cast_array_to
<
const
CastType
>::
from
(
sent_array
);
auto
send_cast_array
=
cast_array_to
<
const
CastType
>::
from
(
sent_array
);
auto
recv_cast_array
=
cast_array_to
<
CastType
>::
from
(
recv_array
);
auto
recv_cast_array
=
cast_array_to
<
CastType
>::
from
(
recv_array
);
...
@@ -282,7 +278,7 @@ class Messenger
...
@@ -282,7 +278,7 @@ class Messenger
if
constexpr
(
std
::
is_arithmetic_v
<
DataType
>
)
{
if
constexpr
(
std
::
is_arithmetic_v
<
DataType
>
)
{
_exchange
(
sent_array_list
,
recv_array_list
);
_exchange
(
sent_array_list
,
recv_array_list
);
}
else
if
constexpr
(
std
::
is_trivial_v
<
DataType
>
)
{
}
else
if
constexpr
(
std
::
is_trivial_v
<
DataType
>
)
{
using
CastType
=
H
elper
::
split_cast_t
<
DataType
>
;
using
CastType
=
h
elper
::
split_cast_t
<
DataType
>
;
_exchange_through_cast
<
SendDataType
,
CastType
>
(
sent_array_list
,
recv_array_list
);
_exchange_through_cast
<
SendDataType
,
CastType
>
(
sent_array_list
,
recv_array_list
);
}
else
{
}
else
{
static_assert
(
std
::
is_trivial_v
<
RecvDataType
>
,
static_assert
(
std
::
is_trivial_v
<
RecvDataType
>
,
...
@@ -366,52 +362,52 @@ void exchange(const std::vector<Array<SendDataType>>& sent_array_list,
...
@@ -366,52 +362,52 @@ void exchange(const std::vector<Array<SendDataType>>& sent_array_list,
#ifdef PASTIS_HAS_MPI
#ifdef PASTIS_HAS_MPI
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
char
>
()
{
return
MPI_CHAR
;
}
Messenger
::
h
elper
::
mpiType
<
char
>
()
{
return
MPI_CHAR
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
int8_t
>
()
{
return
MPI_INT8_T
;
}
Messenger
::
h
elper
::
mpiType
<
int8_t
>
()
{
return
MPI_INT8_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
int16_t
>
()
{
return
MPI_INT16_T
;
}
Messenger
::
h
elper
::
mpiType
<
int16_t
>
()
{
return
MPI_INT16_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
int32_t
>
()
{
return
MPI_INT32_T
;
}
Messenger
::
h
elper
::
mpiType
<
int32_t
>
()
{
return
MPI_INT32_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
int64_t
>
()
{
return
MPI_INT64_T
;
}
Messenger
::
h
elper
::
mpiType
<
int64_t
>
()
{
return
MPI_INT64_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
uint8_t
>
()
{
return
MPI_UINT8_T
;
}
Messenger
::
h
elper
::
mpiType
<
uint8_t
>
()
{
return
MPI_UINT8_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
uint16_t
>
()
{
return
MPI_UINT16_T
;
}
Messenger
::
h
elper
::
mpiType
<
uint16_t
>
()
{
return
MPI_UINT16_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
uint32_t
>
()
{
return
MPI_UINT32_T
;
}
Messenger
::
h
elper
::
mpiType
<
uint32_t
>
()
{
return
MPI_UINT32_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
uint64_t
>
()
{
return
MPI_UINT64_T
;
}
Messenger
::
h
elper
::
mpiType
<
uint64_t
>
()
{
return
MPI_UINT64_T
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
signed
long
long
int
>
()
{
return
MPI_LONG_LONG_INT
;
}
Messenger
::
h
elper
::
mpiType
<
signed
long
long
int
>
()
{
return
MPI_LONG_LONG_INT
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
unsigned
long
long
int
>
()
{
return
MPI_UNSIGNED_LONG_LONG
;
}
Messenger
::
h
elper
::
mpiType
<
unsigned
long
long
int
>
()
{
return
MPI_UNSIGNED_LONG_LONG
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
float
>
()
{
return
MPI_FLOAT
;
}
Messenger
::
h
elper
::
mpiType
<
float
>
()
{
return
MPI_FLOAT
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
double
>
()
{
return
MPI_DOUBLE
;
}
Messenger
::
h
elper
::
mpiType
<
double
>
()
{
return
MPI_DOUBLE
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
long
double
>
()
{
return
MPI_LONG_DOUBLE
;
}
Messenger
::
h
elper
::
mpiType
<
long
double
>
()
{
return
MPI_LONG_DOUBLE
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
wchar_t
>
()
{
return
MPI_WCHAR
;
}
Messenger
::
h
elper
::
mpiType
<
wchar_t
>
()
{
return
MPI_WCHAR
;
}
template
<
>
PASTIS_INLINE
MPI_Datatype
template
<
>
PASTIS_INLINE
MPI_Datatype
Messenger
::
H
elper
::
mpiType
<
bool
>
()
{
return
MPI_CXX_BOOL
;
}
Messenger
::
h
elper
::
mpiType
<
bool
>
()
{
return
MPI_CXX_BOOL
;
}
#endif // PASTIS_HAS_MPI
#endif // PASTIS_HAS_MPI
...
...
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