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
8cbb6ed2
Commit
8cbb6ed2
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add all gather and reduce min/max tests
parent
cd07ecf6
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
tests/mpi_test_Messenger.cpp
+56
-0
56 additions, 0 deletions
tests/mpi_test_Messenger.cpp
with
56 additions
and
0 deletions
tests/mpi_test_Messenger.cpp
+
56
−
0
View file @
8cbb6ed2
...
...
@@ -93,6 +93,14 @@ TEST_CASE("Messenger", "[mpi]") {
REQUIRE
(
size
==
commSize
());
}
SECTION
(
"reduction"
)
{
const
int
min_value
=
allReduceMin
(
commRank
()
+
3
);
REQUIRE
(
min_value
==
3
);
const
int
max_value
=
allReduceMax
(
commRank
()
+
3
);
REQUIRE
(
max_value
==
((
commSize
()
-
1
)
+
3
));
}
SECTION
(
"all to all"
)
{
// chars
mpi_check
::
test_allToAll
<
char
>
();
...
...
@@ -123,6 +131,16 @@ TEST_CASE("Messenger", "[mpi]") {
// compound trivial type
mpi_check
::
test_allToAll
<
mpi_check
::
tri_int
>
();
#ifndef NDEBUG
SECTION
(
"checking invalid all to all"
)
{
Array
<
int
>
invalid_all_to_all
(
commSize
()
+
1
);
REQUIRE_THROWS_AS
(
allToAll
(
invalid_all_to_all
),
AssertError
);
Array
<
int
>
different_size_all_to_all
(
commSize
()
*
(
commRank
()
+
1
));
REQUIRE_THROWS_AS
(
allToAll
(
different_size_all_to_all
),
AssertError
);
}
#endif // NDEBUG
}
SECTION
(
"broadcast value"
)
{
...
...
@@ -182,4 +200,42 @@ TEST_CASE("Messenger", "[mpi]") {
}
}
SECTION
(
"all gather value"
)
{
{
// simple type
int
value
{(
3
+
commRank
())
*
2
};
Array
<
int
>
gather_array
=
allGather
(
value
);
REQUIRE
(
gather_array
.
size
()
==
commSize
());
for
(
size_t
i
=
0
;
i
<
gather_array
.
size
();
++
i
)
{
REQUIRE
((
gather_array
[
i
]
==
(
3
+
i
)
*
2
));
}
}
{
// trivial simple type
mpi_check
::
integer
value
{(
3
+
commRank
())
*
2
};
Array
<
mpi_check
::
integer
>
gather_array
=
allGather
(
value
);
REQUIRE
(
gather_array
.
size
()
==
commSize
());
for
(
size_t
i
=
0
;
i
<
gather_array
.
size
();
++
i
)
{
REQUIRE
((
gather_array
[
i
]
==
(
3
+
i
)
*
2
));
}
}
{
// compound trivial type
mpi_check
::
tri_int
value
{(
3
+
commRank
())
*
2
,
2
+
commRank
(),
4
-
commRank
()};
Array
<
mpi_check
::
tri_int
>
gather_array
=
allGather
(
value
);
REQUIRE
(
gather_array
.
size
()
==
commSize
());
for
(
size_t
i
=
0
;
i
<
gather_array
.
size
();
++
i
)
{
mpi_check
::
tri_int
expected_value
{
static_cast
<
int
>
((
3
+
i
)
*
2
),
static_cast
<
int
>
(
2
+
i
),
static_cast
<
int
>
(
4
-
i
)};
REQUIRE
((
gather_array
[
i
]
==
expected_value
));
}
}
}
}
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