Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
amdis
Commits
66434cfd
Commit
66434cfd
authored
Nov 17, 2012
by
Thomas Witkowski
Browse files
Small feature updates.
parent
d850f7ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/parallel/CheckerPartitioner.cc
View file @
66434cfd
...
...
@@ -16,7 +16,7 @@
namespace
AMDiS
{
void
CheckerPartitioner
::
createInitialPartitioning
()
bool
CheckerPartitioner
::
createInitialPartitioning
()
{
FUNCNAME
(
"CheckerPartitioner::createInitialPartitioning()"
);
...
...
@@ -127,6 +127,8 @@ namespace AMDiS {
elInfo
=
stack
.
traverseNext
(
elInfo
);
}
return
true
;
}
}
AMDiS/src/parallel/CheckerPartitioner.h
View file @
66434cfd
...
...
@@ -62,7 +62,7 @@ namespace AMDiS {
~
CheckerPartitioner
()
{}
void
createInitialPartitioning
();
bool
createInitialPartitioning
();
/// \ref MeshPartitioner::partition
bool
partition
(
map
<
int
,
double
>
&
elemWeights
,
PartitionMode
mode
=
INITIAL
)
...
...
AMDiS/src/parallel/MeshDistributor.cc
View file @
66434cfd
...
...
@@ -357,14 +357,12 @@ namespace AMDiS {
createMacroElementInfo
();
// create an initial partitioning of the mesh
partitioner
->
createInitialPartitioning
();
bool
useInitialPartitioning
=
partitioner
->
createInitialPartitioning
();
// set the element weights, which are 1 at the very first begin
setInitialElementWeights
();
string
filename
=
""
;
Parameters
::
get
(
"parallel->partitioner->read meta arh"
,
filename
);
if
(
filename
==
""
||
ArhReader
::
readMetaData
(
filename
)
!=
mpiSize
)
{
if
(
!
useInitialPartitioning
)
{
// and now partition the mesh
bool
partitioningSucceed
=
partitioner
->
partition
(
elemWeights
,
INITIAL
);
TEST_EXIT
(
partitioningSucceed
)(
"Initial partitioning does not work!
\n
"
);
...
...
AMDiS/src/parallel/MeshPartitioner.cc
View file @
66434cfd
...
...
@@ -18,7 +18,7 @@
namespace
AMDiS
{
void
MeshPartitioner
::
createInitialPartitioning
()
bool
MeshPartitioner
::
createInitialPartitioning
()
{
FUNCNAME
(
"MeshPartitioner::createInitialPartitioning()"
);
...
...
@@ -26,7 +26,7 @@ namespace AMDiS {
int
mpiSize
=
mpiComm
->
Get_size
();
int
nLeaves
=
mesh
->
getNumberOfLeaves
();
int
elPerRank
=
nLeaves
/
mpiSize
;
bool
useInitialPartitioning
=
false
;
// === Check for reading ARH meta file to create initial partitioning. ===
...
...
@@ -35,14 +35,23 @@ namespace AMDiS {
string
partitioningFile
=
""
;
Parameters
::
get
(
"parallel->initial partitioning file"
,
partitioningFile
);
if
(
partitioningFile
!=
""
)
{
if
(
partitioningFile
!=
""
)
{
MSG
(
"Read initial partitioning file: %s
\n
"
,
partitioningFile
.
c_str
());
ifstream
file
;
file
.
open
(
partitioningFile
.
c_str
());
TEST_EXIT
(
file
.
is_open
())(
"Should not happen!
\n
"
);
int
nElements
=
0
;
file
>>
nElements
;
for
(
int
i
=
0
;
i
<
nElements
;
i
++
)
file
>>
mapElInRank
[
i
];
for
(
int
i
=
0
;
i
<
nElements
;
i
++
)
{
int
rank
=
-
1
;
file
>>
rank
;
mapElInRank
[
i
]
=
rank
;
}
file
.
close
();
useInitialPartitioning
=
true
;
}
else
{
string
arhMetaFile
=
""
;
Parameters
::
get
(
"parallel->partitioner->read meta arh"
,
arhMetaFile
);
...
...
@@ -51,6 +60,8 @@ namespace AMDiS {
int
nProc
=
ArhReader
::
readMetaData
(
arhMetaFile
,
mapElInRank
,
arhElCodeSize
);
if
(
nProc
!=
mpiSize
)
partitioningArhBased
=
false
;
else
useInitialPartitioning
=
true
;
}
}
...
...
@@ -157,6 +168,8 @@ namespace AMDiS {
}
}
}
return
useInitialPartitioning
;
}
...
...
AMDiS/src/parallel/MeshPartitioner.h
View file @
66434cfd
...
...
@@ -62,10 +62,16 @@ namespace AMDiS {
virtual
~
MeshPartitioner
()
{}
/// Creates an initial paritioning of the AMDiS mesh. This partitioning
/// can be arbitrary, the only requirement is that each macro element
/// must be uniquely assign to a rank.
virtual
void
createInitialPartitioning
();
/** \brief
* Creates an initial paritioning of the AMDiS mesh. This partitioning
* can be arbitrary, the only requirement is that each macro element
* must be uniquely assign to a rank.
*
* \return If the function returns true, the initial partitioning should
* be used for the very first computations. This can be e.g. due
* to the usage of an initial partitioning file.
*/
virtual
bool
createInitialPartitioning
();
/** \brief
* Function the takes a weighted set of macro elements and returns a
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment