Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADIOS2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
Podhorszki, Norbert
ADIOS2
Commits
cc1f4235
Commit
cc1f4235
authored
8 years ago
by
Podhorszki, Norbert
Browse files
Options
Downloads
Patches
Plain Diff
updates to basic example after team discussion
parent
c50e6c3b
No related branches found
No related tags found
1 merge request
!8
Integrate groupless
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/groupless/basic/reader.cpp
+13
-11
13 additions, 11 deletions
examples/groupless/basic/reader.cpp
examples/groupless/basic/writer.cpp
+6
-5
6 additions, 5 deletions
examples/groupless/basic/writer.cpp
with
19 additions
and
16 deletions
examples/groupless/basic/reader.cpp
+
13
−
11
View file @
cc1f4235
...
@@ -57,10 +57,10 @@ int main( int argc, char* argv [] )
...
@@ -57,10 +57,10 @@ int main( int argc, char* argv [] )
std
::
cout
<<
"List of variables in file: "
<<
bpReader
->
VariableNames
<<
"
\n
"
;
std
::
cout
<<
"List of variables in file: "
<<
bpReader
->
VariableNames
<<
"
\n
"
;
/* NX */
/* NX */
bpReader
->
Read
<
unsigned
int
>
(
"NX"
,
&
Nx
);
// read a Global scalar which has a single value in a step
bpReader
->
Read
<
unsigned
int
>
(
"NX"
,
Nx
);
// read a Global scalar which has a single value in a step
/* nproc */
/* nproc */
bpReader
->
Read
<
int
>
(
"nproc"
,
&
Nwriters
);
// also a global scalar
bpReader
->
Read
<
int
>
(
"nproc"
,
Nwriters
);
// also a global scalar
/* Nparts */
/* Nparts */
...
@@ -70,28 +70,30 @@ int main( int argc, char* argv [] )
...
@@ -70,28 +70,30 @@ int main( int argc, char* argv [] )
// 1D array of Nwriters values.
// 1D array of Nwriters values.
if
(
rank
<
Nwriters
)
if
(
rank
<
Nwriters
)
{
{
std
::
shared_ptr
<
adios
::
Variable
<
void
>
>
varNparts
=
bpReader
.
InquiryVariable
(
"Nparts"
);
std
::
shared_ptr
<
adios
::
Variable
>
varNparts
=
bpReader
.
InquiryVariable
(
"Nparts"
);
std
::
unique_ptr
<
adios
::
Selection
>
selNparts
=
adios
.
SelectionBoundingBox
(
{
1
},
{
rank
}
);
std
::
unique_ptr
<
adios
::
Selection
>
selNparts
=
adios
.
SelectionBoundingBox
(
{
1
},
{
rank
}
);
varNparts
->
SetSelection
(
selNparts
);
varNparts
->
SetSelection
(
selNparts
);
bpReader
->
Read
<
int
>
(
varNparts
,
&
Nparts
);
bpReader
->
Read
<
int
>
(
varNparts
,
Nparts
);
}
}
// or we could just read the whole array by every process
// or we could just read the whole array by every process
std
::
vector
<
int
>
partsV
(
Nwriters
);
std
::
vector
<
int
>
partsV
(
Nwriters
);
bpReader
->
Read
<
int
>
(
"Nparts"
,
&
partsV
);
// read with string name, no selection => read whole array
bpReader
->
Read
<
int
>
(
"Nparts"
,
partsV
.
data
()
);
// read with string name, no selection => read whole array
std
::
vector
<
int
>
partsV
;
bpReader
->
Read
<
int
>
(
"Nparts"
,
partsV
);
// read with string name, no selection => read whole array
(
Nwriters
==
partsV
.
size
())
/* Nice */
/* Nice */
// inquiry about a variable, whose name we know
// inquiry about a variable, whose name we know
std
::
shared_ptr
<
adios
::
Variable
<
void
>
>
varNice
=
bpReader
.
InquiryVariable
(
"Nice"
);
std
::
shared_ptr
<
adios
::
Variable
>
varNice
=
bpReader
.
InquiryVariable
(
"Nice"
);
if
(
varNice
==
nullptr
)
if
(
varNice
==
nullptr
)
throw
std
::
ios_base
::
failure
(
"ERROR: failed to find variable 'myDoubles' in input file
\n
"
);
throw
std
::
ios_base
::
failure
(
"ERROR: failed to find variable 'myDoubles' in input file
\n
"
);
// ? how do we know about the type? std::string varNice->m_Type
// ? how do we know about the type? std::string varNice->m_Type
u
nsigned
long
long
in
t
gdim
=
var
MyDoubles
->
m_GlobalDimensions
[
0
];
// ?member var or member func?
u
int64_
t
gdim
=
var
Nice
->
m_GlobalDimensions
[
0
];
// ?member var or member func?
u
nsigned
long
long
in
t
ldim
=
gdim
/
nproc
;
u
int64_
t
ldim
=
gdim
/
nproc
;
u
nsigned
long
long
in
t
offs
=
rank
*
ldim
;
u
int64_
t
offs
=
rank
*
ldim
;
if
(
rank
==
nproc
-
1
)
if
(
rank
==
nproc
-
1
)
{
{
ldim
=
gdim
-
(
ldim
*
gdim
);
ldim
=
gdim
-
(
ldim
*
gdim
);
...
@@ -122,7 +124,7 @@ int main( int argc, char* argv [] )
...
@@ -122,7 +124,7 @@ int main( int argc, char* argv [] )
varRagged
->
InquiryBlocks
();
varRagged
->
InquiryBlocks
();
// now we have the dimensions per block
// now we have the dimensions per block
unsigned
long
long
int
ldim
=
varRagged
->
blockinfo
[
rank
].
m_Dimensions
[
0
];
unsigned
long
long
int
ldim
=
varRagged
->
blockinfo
[
rank
].
m_Dimensions
[
1
];
RaggedArray
.
resize
(
ldim
);
RaggedArray
.
resize
(
ldim
);
std
::
unique_ptr
<
adios
::
Selection
>
wbsel
=
adios
.
SelectionWriteblock
(
rank
);
std
::
unique_ptr
<
adios
::
Selection
>
wbsel
=
adios
.
SelectionWriteblock
(
rank
);
...
...
This diff is collapsed.
Click to expand it.
examples/groupless/basic/writer.cpp
+
6
−
5
View file @
cc1f4235
...
@@ -82,29 +82,30 @@ int main( int argc, char* argv [] )
...
@@ -82,29 +82,30 @@ int main( int argc, char* argv [] )
if
(
rank
==
0
)
if
(
rank
==
0
)
{
{
// Writing a global scalar from only one process
// Writing a global scalar from only one process
bpWriter
->
Write
<
unsigned
int
>
(
varNX
,
&
Nx
);
bpWriter
->
Write
<
unsigned
int
>
(
varNX
,
Nx
);
}
}
// Writing a local scalar on every process. Will be shown at reading as a 1D array
// Writing a local scalar on every process. Will be shown at reading as a 1D array
bpWriter
->
Write
<
int
>
(
varNparts
,
&
Nparts
);
bpWriter
->
Write
<
int
>
(
varNparts
,
Nparts
);
// Writing a global scalar on every process is useless. Information will be thrown away
// Writing a global scalar on every process is useless. Information will be thrown away
// and only rank 0's data will be in the output
// and only rank 0's data will be in the output
bpWriter
->
Write
<
int
>
(
varNproc
,
&
nproc
);
bpWriter
->
Write
<
int
>
(
varNproc
,
nproc
);
// Make a 1D selection to describe the local dimensions of the variable we write and
// Make a 1D selection to describe the local dimensions of the variable we write and
// its offsets in the global spaces
// its offsets in the global spaces
adios
::
Selection
&
sel
=
adios
.
SelectionBoundingBox
(
{
Nx
},
{
rank
*
Nx
}
);
// local dims and offsets; both as list
adios
::
Selection
&
sel
=
adios
.
SelectionBoundingBox
(
{
Nx
},
{
rank
*
Nx
}
);
// local dims and offsets; both as list
Nice
Array
.
SetSelection
(
sel
);
var
Nice
.
SetSelection
(
sel
);
bpWriter
->
Write
<
double
>
(
varNice
,
NiceArray
.
data
()
);
// Base class Engine own the Write<T> that will call overloaded Write from Derived
bpWriter
->
Write
<
double
>
(
varNice
,
NiceArray
.
data
()
);
// Base class Engine own the Write<T> that will call overloaded Write from Derived
adios
::
Selection
&
lsel
=
adios
.
SelectionBoundingBox
(
{
1
,
Nparts
},
{
rank
,
0
}
);
adios
::
Selection
&
lsel
=
adios
.
SelectionBoundingBox
(
{
1
,
Nparts
},
{
rank
,
0
}
);
Ragged
Array
.
SetSelection
(
sel
);
var
Ragged
.
SetSelection
(
sel
);
bpWriter
->
Write
<
float
>
(
varRagged
,
RaggedArray
.
data
()
);
// Base class Engine own the Write<T> that will call overloaded Write from Derived
bpWriter
->
Write
<
float
>
(
varRagged
,
RaggedArray
.
data
()
);
// Base class Engine own the Write<T> that will call overloaded Write from Derived
// Indicate we are done for this step
// Indicate we are done for this step
// N-to-M Aggregation, disk I/O will be performed during this call, unless
// N-to-M Aggregation, disk I/O will be performed during this call, unless
// time aggregation postpones all of that to some later step
// time aggregation postpones all of that to some later step
bpWriter
->
Advance
(
);
bpWriter
->
Advance
(
);
bpWriter
->
AdvanceAsync
(
callback_func_to_notify_me
);
// Called once: indicate that we are done with this output for the run
// Called once: indicate that we are done with this output for the run
bpWriter
->
Close
(
);
bpWriter
->
Close
(
);
...
...
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