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
f8b39f8a
Commit
f8b39f8a
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Change signature of broadcast operations. Value is modified in-place.
parent
83e9fc66
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
+5
-7
5 additions, 7 deletions
src/utils/Messenger.hpp
with
5 additions
and
7 deletions
src/utils/Messenger.hpp
+
5
−
7
View file @
f8b39f8a
...
@@ -258,11 +258,10 @@ class Messenger
...
@@ -258,11 +258,10 @@ class Messenger
template
<
typename
DataType
>
template
<
typename
DataType
>
PASTIS_INLINE
PASTIS_INLINE
DataType
broadcast
(
const
DataType
&
data
,
int
root_rank
)
const
void
broadcast
(
DataType
&
data
,
int
root_rank
)
const
{
{
if
constexpr
(
std
::
is_same
<
DataType
,
int
>
())
{
if
constexpr
(
std
::
is_same
<
DataType
,
int
>
())
{
int
int_data
=
data
;
return
_broadcast_value
(
data
,
root_rank
);
return
_broadcast_value
(
int_data
,
root_rank
);
}
else
{
}
else
{
static_assert
(
std
::
is_same
<
DataType
,
int
>
(),
"unexpected type of data"
);
static_assert
(
std
::
is_same
<
DataType
,
int
>
(),
"unexpected type of data"
);
}
}
...
@@ -270,7 +269,7 @@ class Messenger
...
@@ -270,7 +269,7 @@ class Messenger
template
<
typename
DataType
>
template
<
typename
DataType
>
PASTIS_INLINE
PASTIS_INLINE
Array
<
DataType
>
broadcast
(
const
Array
<
DataType
>&
array
,
int
root_rank
)
const
void
broadcast
(
Array
<
DataType
>&
array
,
int
root_rank
)
const
{
{
static_assert
(
not
std
::
is_const_v
<
DataType
>
,
static_assert
(
not
std
::
is_const_v
<
DataType
>
,
"cannot broadcast array of const"
);
"cannot broadcast array of const"
);
...
@@ -295,7 +294,6 @@ class Messenger
...
@@ -295,7 +294,6 @@ class Messenger
static_assert
(
std
::
is_trivial_v
<
DataType
>
,
static_assert
(
std
::
is_trivial_v
<
DataType
>
,
"unexpected non trivial type of data"
);
"unexpected non trivial type of data"
);
}
}
return
array
;
}
}
template
<
typename
SendDataType
,
template
<
typename
SendDataType
,
...
@@ -375,9 +373,9 @@ allToAll(const Array<DataType>& array)
...
@@ -375,9 +373,9 @@ allToAll(const Array<DataType>& array)
template
<
typename
DataType
>
template
<
typename
DataType
>
PASTIS_INLINE
PASTIS_INLINE
Array
<
DataType
>
broadcast
(
const
Array
<
DataType
>&
array
,
int
root_rank
)
void
broadcast
(
Array
<
DataType
>&
array
,
int
root_rank
)
{
{
return
messenger
().
broadcast
(
array
,
root_rank
);
messenger
().
broadcast
(
array
,
root_rank
);
}
}
template
<
typename
SendDataType
,
template
<
typename
SendDataType
,
...
...
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