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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Kevin Griffin
VTK
Commits
291b4803
Commit
291b4803
authored
1 month ago
by
Louis Gombert
Browse files
Options
Downloads
Patches
Plain Diff
Test HTG GCG in partitioned case
parent
aa4b4413
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
Filters/Parallel/Testing/Cxx/TestHyperTreeGridGhostCellsGenerator.cxx
+103
-4
103 additions, 4 deletions
...llel/Testing/Cxx/TestHyperTreeGridGhostCellsGenerator.cxx
with
103 additions
and
4 deletions
Filters/Parallel/Testing/Cxx/TestHyperTreeGridGhostCellsGenerator.cxx
+
103
−
4
View file @
291b4803
...
...
@@ -14,6 +14,7 @@
#include
"vtkTestUtilities.h"
#include
"vtkUnsignedCharArray.h"
#include
"vtkXMLHyperTreeGridReader.h"
#include
<vtkPartitionedDataSet.h>
namespace
{
...
...
@@ -310,7 +311,6 @@ int TestGhostNullPart(vtkMPIController* controller)
// Create GCG
vtkNew
<
vtkHyperTreeGridGhostCellsGenerator
>
generator
;
generator
->
SetDebug
(
true
);
generator
->
SetInputConnection
(
htgSource
->
GetOutputPort
());
vtkSmartPointer
<
vtkHyperTreeGrid
>
htg
(
generator
->
GetHyperTreeGridOutput
());
if
(
generator
->
UpdatePiece
(
myRank
,
nbRanks
,
0
)
!=
1
)
...
...
@@ -356,8 +356,6 @@ int TestGhostNullPart(vtkMPIController* controller)
*/
int
TestGhostSinglePiece
(
vtkMPIController
*
controller
,
const
std
::
string
&
filename
)
{
int
ret
=
EXIT_SUCCESS
;
int
myRank
=
controller
->
GetLocalProcessId
();
int
nbRanks
=
controller
->
GetNumberOfProcesses
();
...
...
@@ -386,8 +384,106 @@ int TestGhostSinglePiece(vtkMPIController* controller, const std::string& filena
vtkErrorWithObjectMacro
(
nullptr
,
<<
"Wrong number of ghost cells generated for process "
<<
myRank
<<
". Has "
<<
nbCellsAfter
<<
" but expect "
<<
nbCellsBefore
);
ret
=
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
return
EXIT_SUCCESS
;
}
/**
* HTG GhostCells should handle properly data separated in multiple partitions inside of a
* PartitionedDataSet (PDS). It should not matter whether the PDS has a single partition containing
* the data for all ranks, or multiple, that may or may not correspond to the number of ranks. This
* can happen for example when you write the PDS in an MPI setting of X ranks, but open it back with
* Y ranks.
*
* `config` sets up different PDS configuration schemes:
* - 0 will test the classic case of 1 different partition for each piece
* - 1 will test with only 1 partition containing a distributed HTG
* - 2 will test a PDS with 2 partitions, containing HTGs on 2 ranks each
*/
int
TestPartitionedHTG
(
vtkMPIController
*
controller
,
int
config
)
{
int
myRank
=
controller
->
GetLocalProcessId
();
int
nbRanks
=
controller
->
GetNumberOfProcesses
();
vtkNew
<
vtkRandomHyperTreeGridSource
>
htgSource
;
htgSource
->
SetSeed
(
3
);
htgSource
->
SetMaxDepth
(
3
);
htgSource
->
SetDimensions
(
3
,
3
,
3
);
htgSource
->
UpdatePiece
(
myRank
,
nbRanks
,
0
);
vtkNew
<
vtkPartitionedDataSet
>
pdsSource
;
vtkHyperTreeGrid
*
inputHTG
=
htgSource
->
GetHyperTreeGridOutput
();
// In which partition to place data
const
std
::
array
<
unsigned
int
,
4
>
configPartition
=
{
static_cast
<
unsigned
int
>
(
myRank
),
0
,
static_cast
<
unsigned
int
>
(
myRank
%
2
)
};
pdsSource
->
SetPartition
(
configPartition
[
config
],
inputHTG
);
// How many parts total
const
std
::
array
<
unsigned
int
,
3
>
configNumberOfParts
=
{
static_cast
<
unsigned
int
>
(
nbRanks
),
1
,
2
};
pdsSource
->
SetNumberOfPartitions
(
configNumberOfParts
[
config
]);
// Create and execute GCG
vtkNew
<
vtkHyperTreeGridGhostCellsGenerator
>
generator
;
generator
->
SetDebug
(
true
);
generator
->
SetInputData
(
pdsSource
);
vtkSmartPointer
<
vtkPartitionedDataSet
>
outputPDS
=
vtkPartitionedDataSet
::
SafeDownCast
(
generator
->
GetOutputDataObject
(
0
));
if
(
generator
->
UpdatePiece
(
myRank
,
nbRanks
,
0
)
!=
1
)
{
vtkErrorWithObjectMacro
(
nullptr
,
<<
"Fail to update piece for process "
<<
myRank
);
return
EXIT_FAILURE
;
}
if
(
outputPDS
->
GetNumberOfPartitions
()
!=
configNumberOfParts
[
config
])
{
vtkErrorWithObjectMacro
(
nullptr
,
<<
"Expected 4 partitions in output PartitionedDataSet but got "
<<
outputPDS
->
GetNumberOfPartitions
());
return
EXIT_FAILURE
;
}
int
ret
=
EXIT_SUCCESS
;
// Only one partition on each rank is expected to be non-null.
const
std
::
array
<
vtkIdType
,
4
>
expectedNbOfCells
=
{
336
,
288
,
408
,
240
};
for
(
unsigned
int
partId
=
0
;
partId
<
outputPDS
->
GetNumberOfPartitions
();
partId
++
)
{
vtkHyperTreeGrid
*
partHTG
=
vtkHyperTreeGrid
::
SafeDownCast
(
outputPDS
->
GetPartitionAsDataObject
(
partId
));
if
(
partId
!=
configPartition
[
config
])
{
if
(
partHTG
)
{
vtkErrorWithObjectMacro
(
nullptr
,
<<
"Partition "
<<
partId
<<
" on rank "
<<
myRank
<<
" should be null, but is not."
);
ret
=
EXIT_FAILURE
;
}
}
else
{
if
(
!
partHTG
)
{
vtkErrorWithObjectMacro
(
nullptr
,
<<
"Partition "
<<
partId
<<
" on rank "
<<
myRank
<<
" should not be null."
);
ret
=
EXIT_FAILURE
;
}
else
{
vtkIdType
nbCellsAfterGCG
=
partHTG
->
GetNumberOfCells
();
if
(
expectedNbOfCells
[
myRank
]
!=
nbCellsAfterGCG
)
{
vtkErrorWithObjectMacro
(
nullptr
,
<<
"Wrong number of ghost cells generated for process "
<<
myRank
<<
". Has "
<<
nbCellsAfterGCG
<<
" but expect "
<<
expectedNbOfCells
[
myRank
]);
ret
=
EXIT_FAILURE
;
}
}
}
}
return
ret
;
}
}
...
...
@@ -426,6 +522,9 @@ int TestHyperTreeGridGhostCellsGenerator(int argc, char* argv[])
ret
|=
::
TestGhost2D
(
controller
);
ret
|=
::
TestGhostNullPart
(
controller
);
ret
|=
::
TestGhostSinglePiece
(
controller
,
htgFileName
);
ret
|=
::
TestPartitionedHTG
(
controller
,
0
);
ret
|=
::
TestPartitionedHTG
(
controller
,
1
);
ret
|=
::
TestPartitionedHTG
(
controller
,
2
);
controller
->
Finalize
();
return
ret
;
...
...
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