Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
solverstack
ScalFMM
Commits
d739df70
Commit
d739df70
authored
10 years ago
by
BRAMAS Berenger
Browse files
Options
Downloads
Patches
Plain Diff
Manage the case when a node has all the same and so pivot equal max
parent
a8f5ad2f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Src/Utils/FQuickSortMpi.hpp
+2
-1
2 additions, 1 deletion
Src/Utils/FQuickSortMpi.hpp
UTests/utestMpiQs.cpp
+27
-0
27 additions, 0 deletions
UTests/utestMpiQs.cpp
with
29 additions
and
1 deletion
Src/Utils/FQuickSortMpi.hpp
+
2
−
1
View file @
d739df70
...
...
@@ -228,7 +228,8 @@ class FQuickSortMpi : public FQuickSort< SortType, CompareType, IndexType> {
if
(
!
noValues
){
localPivot
=
(
CompareType
(
workingArray
[
currentSize
/
3
])
+
CompareType
(
workingArray
[(
2
*
currentSize
)
/
3
]))
/
2
;
// The pivot must be different (to ensure that the partition will return two parts)
if
(
localPivot
==
maxFoundValue
){
if
(
localPivot
==
maxFoundValue
&&
!
allTheSame
){
////FLOG( FLog::Controller << currentComm.processId() << "] Pivot " << localPivot << " is equal max and allTheSame equal " << allTheSame << "\n"; )
localPivot
-=
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
UTests/utestMpiQs.cpp
+
27
−
0
View file @
d739df70
...
...
@@ -243,6 +243,32 @@ class TestMpiQs : public FUTesterMpi<TestMpiQs> {
}
void
TestPivotSort
(){
const
int
myRank
=
app
.
global
().
processId
();
const
int
nbProcess
=
app
.
global
().
processCount
();
const
int
nbElements
=
500
;
std
::
unique_ptr
<
long
[]
>
elements
(
new
long
[
nbElements
]);
for
(
int
idx
=
0
;
idx
<
nbElements
;
++
idx
){
elements
[
idx
]
=
10000
;
}
elements
[
0
]
=
9999
;
const
int
nbElementsInTest
=
app
.
global
().
reduceSum
(
nbElements
);
int
outSize
;
long
*
outElements
=
nullptr
;
FQuickSortMpi
<
long
,
long
,
int
>::
QsMpi
(
elements
.
get
(),
nbElements
,
&
outElements
,
&
outSize
,
app
.
global
());
CheckIfSorted
(
outElements
,
outSize
);
CheckBorder
(
outElements
,
outSize
);
uassert
(
nbElementsInTest
==
app
.
global
().
reduceSum
(
outSize
));
delete
[]
outElements
;
}
////////////////////////////////////////////////////////////
/// Starter functions
////////////////////////////////////////////////////////////
...
...
@@ -254,6 +280,7 @@ class TestMpiQs : public FUTesterMpi<TestMpiQs> {
AddTest
(
&
TestMpiQs
::
TestSameSort
,
"Test with all the same value"
);
AddTest
(
&
TestMpiQs
::
TestUniqueSort
,
"Test with unique value"
);
AddTest
(
&
TestMpiQs
::
TestBigSort
,
"Test with random values"
);
AddTest
(
&
TestMpiQs
::
TestPivotSort
,
"Test with big pivot"
);
}
public
:
TestMpiQs
(
int
argc
,
char
**
argv
)
:
FUTesterMpi
(
argc
,
argv
){
...
...
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