Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Buehlmann
GenericIO
Commits
7ff84e05
Commit
7ff84e05
authored
Aug 26, 2016
by
Hal Finkel
Browse files
When rewriting, allow for redistribution; preserve topology info when a cart comm can be created
parent
fc4fc2fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
GenericIORewrite.cxx
View file @
7ff84e05
...
...
@@ -38,7 +38,13 @@ int main(int argc, char *argv[]) {
Method
=
GenericIO
::
FileIOMPI
;
GenericIO
GIO
(
MPI_COMM_WORLD
,
FileName
,
Method
);
GIO
.
openAndReadHeader
(
GenericIO
::
MismatchDisallowed
);
GIO
.
openAndReadHeader
(
GenericIO
::
MismatchRedistribute
);
int
NR
=
GIO
.
readNRanks
();
if
(
!
Rank
&&
NR
!=
NRanks
)
{
cout
<<
"Redistributing data from "
<<
NR
<<
" ranks to "
<<
NRanks
<<
" ranks; dropping rank topology information!
\n
"
;
}
vector
<
GenericIO
::
VariableInfo
>
VI
;
GIO
.
getVariableInfo
(
VI
);
...
...
@@ -57,7 +63,15 @@ int main(int argc, char *argv[]) {
GIO
.
readData
(
-
1
,
false
);
GenericIO
NewGIO
(
MPI_COMM_WORLD
,
NewFileName
);
MPI_Comm
Comm
=
MPI_COMM_WORLD
;
if
(
NR
==
NRanks
)
{
int
Periods
[
3
]
=
{
0
,
0
,
0
};
int
Dims
[
3
];
GIO
.
readDims
(
Dims
);
MPI_Cart_create
(
Comm
,
3
,
Dims
,
Periods
,
0
,
&
Comm
);
}
GenericIO
NewGIO
(
Comm
,
NewFileName
);
NewGIO
.
setNumElems
(
NElem
);
for
(
int
d
=
0
;
d
<
3
;
++
d
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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