Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Migliore
VTK
Commits
97b501eb
Commit
97b501eb
authored
1 year ago
by
Julien Fausty
Browse files
Options
Downloads
Patches
Plain Diff
MPIController: add probing test
parent
b26cf4ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Parallel/MPI/Testing/Cxx/MPIController.cxx
+57
-0
57 additions, 0 deletions
Parallel/MPI/Testing/Cxx/MPIController.cxx
with
57 additions
and
0 deletions
Parallel/MPI/Testing/Cxx/MPIController.cxx
+
57
−
0
View file @
97b501eb
...
...
@@ -21,10 +21,65 @@
#include
"vtkSmartPointer.h"
#define VTK_CREATE(type, name) vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
#include
<set>
namespace
{
int
mpiTag
=
5678
;
int
data
=
-
1
;
int
PROBE_TAG
=
4244
;
bool
CheckProbing
(
vtkMPIController
*
controller
)
{
int
rank
=
controller
->
GetLocalProcessId
();
int
numRanks
=
controller
->
GetNumberOfProcesses
();
if
(
rank
!=
0
)
{
controller
->
Send
(
&
rank
,
1
,
0
,
PROBE_TAG
);
}
else
{
std
::
set
<
int
>
other_ranks
;
for
(
int
iR
=
1
;
iR
<
numRanks
;
++
iR
)
{
other_ranks
.
insert
(
iR
);
}
for
(
int
iR
=
1
;
iR
<
numRanks
;
++
iR
)
{
int
sendingRank
=
-
1
;
if
(
controller
->
Probe
(
vtkMultiProcessController
::
ANY_SOURCE
,
PROBE_TAG
,
&
sendingRank
)
==
0
)
{
std
::
cerr
<<
"Probe operation failed."
<<
std
::
endl
;
return
false
;
}
if
(
sendingRank
<
0
)
{
std
::
cerr
<<
"Probe returned negative rank."
<<
std
::
endl
;
return
false
;
}
auto
it
=
other_ranks
.
find
(
sendingRank
);
if
(
it
==
other_ranks
.
end
())
{
std
::
cerr
<<
"Probe already received from rank "
<<
sendingRank
<<
std
::
endl
;
return
false
;
}
other_ranks
.
erase
(
it
);
int
other_rank
=
-
1
;
controller
->
Receive
(
&
other_rank
,
1
,
sendingRank
,
PROBE_TAG
);
}
if
(
!
other_ranks
.
empty
())
{
std
::
cerr
<<
"Did not probe all messages"
<<
std
::
endl
;
return
false
;
}
}
return
true
;
}
}
// returns 0 for success
...
...
@@ -175,6 +230,8 @@ int MPIController(int argc, char* argv[])
retval
=
ExerciseMultiProcessController
(
genericController
);
}
retval
=
retval
|
(
::
CheckProbing
(
controller
)
?
0
:
1
);
controller
->
Finalize
();
return
retval
;
...
...
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