Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
waLBerla
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sudesh Rathnayake
waLBerla
Commits
13760c48
Commit
13760c48
authored
4 years ago
by
Sebastian Eibl
Browse files
Options
Downloads
Patches
Plain Diff
allToAll and allToLower test for communication with unknown sender ranks
parent
5110ba9b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/mpi/BufferSystem.h
+1
-0
1 addition, 0 deletions
src/core/mpi/BufferSystem.h
src/core/mpi/BufferSystem.impl.h
+14
-0
14 additions, 0 deletions
src/core/mpi/BufferSystem.impl.h
tests/core/mpi/BufferSystemTest.cpp
+90
-0
90 additions, 0 deletions
tests/core/mpi/BufferSystemTest.cpp
with
105 additions
and
0 deletions
src/core/mpi/BufferSystem.h
+
1
−
0
View file @
13760c48
...
@@ -129,6 +129,7 @@ public:
...
@@ -129,6 +129,7 @@ public:
template
<
typename
RankIter
>
void
setReceiverInfo
(
RankIter
begin
,
RankIter
end
,
bool
changingSize
);
template
<
typename
RankIter
>
void
setReceiverInfo
(
RankIter
begin
,
RankIter
end
,
bool
changingSize
);
template
<
typename
Range
>
void
setReceiverInfo
(
const
Range
&
range
,
bool
changingSize
);
template
<
typename
Range
>
void
setReceiverInfo
(
const
Range
&
range
,
bool
changingSize
);
void
setReceiverInfo
(
const
std
::
set
<
MPIRank
>
&
ranksToRecvFrom
,
bool
changingSize
);
void
setReceiverInfo
(
const
std
::
set
<
MPIRank
>
&
ranksToRecvFrom
,
bool
changingSize
);
void
setReceiverInfo
(
const
int
numReceives
);
void
setReceiverInfo
(
const
std
::
map
<
MPIRank
,
MPISize
>
&
ranksToRecvFrom
);
void
setReceiverInfo
(
const
std
::
map
<
MPIRank
,
MPISize
>
&
ranksToRecvFrom
);
void
setReceiverInfoFromSendBufferState
(
bool
useSizeFromSendBuffers
,
bool
changingSize
);
void
setReceiverInfoFromSendBufferState
(
bool
useSizeFromSendBuffers
,
bool
changingSize
);
...
...
This diff is collapsed.
Click to expand it.
src/core/mpi/BufferSystem.impl.h
+
14
−
0
View file @
13760c48
...
@@ -219,6 +219,20 @@ void GenericBufferSystem<Rb, Sb>::setReceiverInfo( const std::set<MPIRank> & ran
...
@@ -219,6 +219,20 @@ void GenericBufferSystem<Rb, Sb>::setReceiverInfo( const std::set<MPIRank> & ran
//**********************************************************************************************************************
/*! Sets receiver information, when the number of receives is known but the ranks are unknown
*
* \param numReceives number of expected messages
*/
//**********************************************************************************************************************
template
<
typename
Rb
,
typename
Sb
>
void
GenericBufferSystem
<
Rb
,
Sb
>::
setReceiverInfo
(
const
int
numReceives
)
{
WALBERLA_ABORT
(
"NOT IMPLEMENTED!"
);
}
//**********************************************************************************************************************
//**********************************************************************************************************************
/*! Sets receiver information, when message sizes are known
/*! Sets receiver information, when message sizes are known
*
*
...
...
This diff is collapsed.
Click to expand it.
tests/core/mpi/BufferSystemTest.cpp
+
90
−
0
View file @
13760c48
...
@@ -301,6 +301,90 @@ void gatherUsingAsymmetricCommunication(const bool useIProbe)
...
@@ -301,6 +301,90 @@ void gatherUsingAsymmetricCommunication(const bool useIProbe)
}
}
/**
* Test for communication when only the number of receives is known but not the ranks.
*/
void
unknownRanksAllToAll
()
{
const
int
rank
=
MPIManager
::
instance
()
->
worldRank
();
const
int
numProcesses
=
MPIManager
::
instance
()
->
numProcesses
();
WALBERLA_CHECK_GREATER_EQUAL
(
numProcesses
,
3
);
BufferSystem
bs
(
MPI_COMM_WORLD
,
42
);
for
(
auto
targetRank
=
0
;
targetRank
<
numProcesses
;
++
targetRank
)
{
auto
&
sb
=
bs
.
sendBuffer
(
targetRank
);
for
(
int
i
=
0
;
i
<
rank
+
1
;
++
i
)
sb
<<
rank
;
}
//we await numProcesses messages on every rank
bs
.
setReceiverInfo
(
numProcesses
);
//equivalent to
//bs.setReceiverInfoFromSendBufferState(false, true);
bs
.
sendAll
();
auto
numReceives
=
0
;
for
(
auto
it
=
bs
.
begin
();
it
!=
bs
.
end
();
++
it
)
{
WALBERLA_CHECK_EQUAL
(
it
.
buffer
().
size
(),
(
it
.
rank
()
+
1
)
*
4
);
for
(
int
i
=
0
;
i
<
it
.
rank
()
+
1
;
++
i
)
{
int
received
=
-
1
;
it
.
buffer
()
>>
received
;
WALBERLA_CHECK_EQUAL
(
received
,
it
.
rank
());
}
++
numReceives
;
}
WALBERLA_CHECK_EQUAL
(
numReceives
,
numProcesses
);
}
void
unknownRanksAllToLower
()
{
const
int
rank
=
MPIManager
::
instance
()
->
worldRank
();
const
int
numProcesses
=
MPIManager
::
instance
()
->
numProcesses
();
WALBERLA_CHECK_GREATER_EQUAL
(
numProcesses
,
3
);
BufferSystem
bs
(
MPI_COMM_WORLD
,
42
);
for
(
auto
targetRank
=
0
;
targetRank
<
rank
+
1
;
++
targetRank
)
{
auto
&
sb
=
bs
.
sendBuffer
(
targetRank
);
for
(
int
i
=
0
;
i
<
rank
+
1
;
++
i
)
sb
<<
rank
;
}
//we await numProcesses messages on every rank
bs
.
setReceiverInfo
(
numProcesses
);
//equivalent to
//std::set<mpi::MPIRank> recvs;
//for (auto targetRank = numProcesses - 1; targetRank >=rank; --targetRank)
//{
// recvs.emplace(targetRank);
//}
//bs.setReceiverInfo(recvs, true);
bs
.
sendAll
();
auto
numReceives
=
0
;
for
(
auto
it
=
bs
.
begin
();
it
!=
bs
.
end
();
++
it
)
{
WALBERLA_CHECK_EQUAL
(
it
.
buffer
().
size
(),
(
it
.
rank
()
+
1
)
*
4
);
for
(
int
i
=
0
;
i
<
it
.
rank
()
+
1
;
++
i
)
{
int
received
=
-
1
;
it
.
buffer
()
>>
received
;
WALBERLA_CHECK_EQUAL
(
received
,
it
.
rank
());
}
++
numReceives
;
}
WALBERLA_CHECK_EQUAL
(
numReceives
,
numProcesses
-
rank
);
}
void
selfSend
()
void
selfSend
()
{
{
int
rank
=
MPIManager
::
instance
()
->
worldRank
();
int
rank
=
MPIManager
::
instance
()
->
worldRank
();
...
@@ -395,6 +479,12 @@ int main(int argc, char**argv)
...
@@ -395,6 +479,12 @@ int main(int argc, char**argv)
gatherUsingAsymmetricCommunication
(
false
);
gatherUsingAsymmetricCommunication
(
false
);
gatherUsingAsymmetricCommunication
(
true
);
gatherUsingAsymmetricCommunication
(
true
);
WALBERLA_LOG_INFO_ON_ROOT
(
"Testing Unknown Sender Ranks..."
);
WALBERLA_LOG_INFO_ON_ROOT
(
"AllToAll..."
);
unknownRanksAllToAll
();
WALBERLA_LOG_INFO_ON_ROOT
(
"AllToLower..."
);
unknownRanksAllToLower
();
WALBERLA_LOG_INFO_ON_ROOT
(
"Testing self-send..."
);
WALBERLA_LOG_INFO_ON_ROOT
(
"Testing self-send..."
);
selfSend
();
selfSend
();
...
...
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