Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Mpp
MLMC
Commits
1544f94b
Commit
1544f94b
authored
Nov 27, 2020
by
niklas.baumgarten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
worked on test
parent
c39b95a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
mlmc/tests/TestParallelization.cpp
mlmc/tests/TestParallelization.cpp
+18
-14
No files found.
mlmc/tests/TestParallelization.cpp
View file @
1544f94b
...
...
@@ -16,6 +16,11 @@ TEST(TestParallel, TestBroadcastInt) {
if
(
!
PPM
->
master
())
EXPECT_EQ
(
PPM
->
BroadcastInt
(),
1
);
}
TEST
(
TestParallel
,
TestBroadcastInt2
)
{
if
(
PPM
->
master
())
PPM
->
Broadcast
(
1
);
if
(
!
PPM
->
master
())
EXPECT_EQ
(
1
,
PPM
->
Broadcast
<
int
>
());
}
struct
BroadcastStruct
{
int
integer
;
...
...
@@ -69,13 +74,6 @@ TEST(TestParallel, TestComplexSum) {
EXPECT_EQ
(
PPM
->
Sum
(
a
),
b
);
}
TEST
(
TestParallel
,
TestNonExistingSum
)
{
// FLAGS_gtest_death_test_style = "threadsafe";
// std::string a = "I'm not summable";
// EXPECT_EXIT(PPM->Sum(a), ExitedWithCode(1),
// "Sum not implemented for " + std::string(Type(std::string{})));
}
TEST
(
TestParallel
,
TestIntegerMin
)
{
int
a
;
if
(
PPM
->
master
())
a
=
1
;
...
...
@@ -136,15 +134,21 @@ TEST(TestParallel, TestUnsignedIntMax) {
EXPECT_EQ
(
PPM
->
Max
(
a
),
1
);
}
TEST
(
TestParallel
,
TestSplit
)
{
PPM
->
NewCommunicators
(
-
1
,
4
);
auto
worldComm
=
PPM
->
GetComm
(
-
1
);
auto
comm
=
PPM
->
GetComm
(
0
);
std
::
cout
<<
"World rank/size: "
<<
worldComm
->
p
<<
"/"
<<
worldComm
->
P
<<
"
\t
"
<<
"Comm rank/size: "
<<
comm
->
p
<<
"/"
<<
comm
->
P
<<
"
\t
"
<<
endl
;
TEST
(
TestParallel
,
TestSplitProc
)
{
int
partitions
=
2
;
PPM
->
SplitCommunicator
(
-
1
,
partitions
);
if
(
PPM
->
master
(
-
1
))
EXPECT_EQ
(
PPM
->
proc
(
-
1
),
0
);
if
(
!
PPM
->
master
(
-
1
))
EXPECT_NE
(
PPM
->
proc
(
-
1
),
0
);
// EXPECT_EQ(comm->Master(), worldComm->Master());
if
(
PPM
->
master
(
0
))
EXPECT_EQ
(
PPM
->
proc
(
0
),
0
);
if
(
!
PPM
->
master
(
0
))
EXPECT_NE
(
PPM
->
proc
(
0
),
0
);
int
testSize
;
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
testSize
);
EXPECT_EQ
(
PPM
->
size
(
-
1
),
testSize
);
EXPECT_EQ
(
PPM
->
size
(
0
)
*
partitions
,
testSize
);
EXPECT_EQ
(
PPM
->
size
(
1
)
*
partitions
,
testSize
);
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment