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
81158552
Commit
81158552
authored
7 years ago
by
wgodoy
Browse files
Options
Downloads
Patches
Plain Diff
Fixing BPFileReader
parent
396a42fe
No related branches found
No related tags found
1 merge request
!124
Refactor
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/adios2/engine/bp/BPFileReader.cpp
+27
-102
27 additions, 102 deletions
source/adios2/engine/bp/BPFileReader.cpp
source/adios2/engine/bp/BPFileReader.h
+15
-37
15 additions, 37 deletions
source/adios2/engine/bp/BPFileReader.h
with
42 additions
and
139 deletions
source/adios2/engine/bp/BPFileReader.cpp
+
27
−
102
View file @
81158552
...
...
@@ -5,32 +5,45 @@
* BPFileReader.cpp
*
* Created on: Feb 27, 2017
* Author:
wfg
* Author:
William F Godoy godoywf@ornl.gov
*/
#include
"BPFileReader.h"
#include
"../../helper/adiosFunctions.h"
// CSVToVector
#include
"../../toolkit/transport/file/FileDescriptor.h"
// uses POSIX
#include
"../../toolkit/transport/file/FilePointer.h"
// uses C FILE*
#include
"../../toolkit/transport/file/FileStream.h"
// uses C++ fstream
#include
"adios2/core/Support.h"
#include
"adios2/helper/adiosFunctions.h"
// CSVToVector
namespace
adios
{
BPFileReader
::
BPFileReader
(
ADIOS
&
adios
,
const
std
::
string
&
name
,
const
std
::
string
accessMode
,
MPI_Comm
mpiComm
,
const
Method
&
method
)
:
Engine
(
adios
,
"BPFileReader"
,
name
,
accessMode
,
mpiComm
,
method
,
" BPFileReader constructor (or call to ADIOS Open).
\n
"
),
m_Heap
(
m_DebugMode
)
BPFileReader
::
BPFileReader
(
IO
&
io
,
const
std
::
string
&
name
,
const
OpenMode
openMode
,
MPI_Comm
mpiComm
)
:
Engine
(
"BPFileReader"
,
io
,
name
,
openMode
,
mpiComm
)
{
Init
();
}
Variable
<
void
>
*
BPFileReader
::
InquireVariable
(
const
std
::
string
&
/*name*/
,
const
bool
/*readIn*/
)
void
BPFileReader
::
Close
(
const
int
/*transportIndex*/
)
{}
// PRIVATE
void
BPFileReader
::
Init
()
{
if
(
m_DebugMode
==
true
)
{
if
(
m_OpenMode
!=
OpenMode
::
r
&&
m_OpenMode
!=
OpenMode
::
Read
)
{
throw
std
::
invalid_argument
(
"ERROR: BPFileReader only supports OpenMode::r from"
+
m_Name
+
" "
+
m_EndMessage
);
}
}
InitTransports
();
}
void
BPFileReader
::
InitTransports
()
{}
VariableBase
*
BPFileReader
::
InquireVariableUnknown
(
const
std
::
string
&
/*name*/
,
const
bool
/*readIn*/
)
{
// not yet implemented
return
nullptr
;
...
...
@@ -140,92 +153,4 @@ BPFileReader::InquireVariableCompound(const std::string & /*name*/,
return
nullptr
;
}
void
BPFileReader
::
Close
(
const
int
/*transportIndex*/
)
{}
// PRIVATE
void
BPFileReader
::
Init
()
{
if
(
m_DebugMode
==
true
)
{
if
(
m_AccessMode
!=
"r"
&&
m_AccessMode
!=
"read"
)
{
throw
std
::
invalid_argument
(
"ERROR: BPFileReader doesn't support access mode "
+
m_AccessMode
+
", in call to ADIOS Open or BPFileReader constructor
\n
"
);
}
}
InitTransports
();
}
void
BPFileReader
::
InitTransports
()
// maybe move this?
{
if
(
m_DebugMode
==
true
)
{
if
(
TransportNamesUniqueness
()
==
false
)
{
throw
std
::
invalid_argument
(
"ERROR: two transports of the same kind (e.g file IO) "
"can't have the same name, modify with name= in Method "
"AddTransport
\n
"
);
}
}
for
(
const
auto
&
parameters
:
m_Method
.
m_TransportParameters
)
{
auto
itTransport
=
parameters
.
find
(
"transport"
);
if
(
itTransport
->
second
==
"file"
||
itTransport
->
second
==
"File"
)
{
auto
itLibrary
=
parameters
.
find
(
"library"
);
if
(
itLibrary
==
parameters
.
end
()
||
itLibrary
->
second
==
"POSIX"
)
// use default POSIX
{
auto
file
=
std
::
make_shared
<
transport
::
FileDescriptor
>
(
m_MPIComm
,
m_DebugMode
);
// m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
m_Transports
.
push_back
(
std
::
move
(
file
));
}
else
if
(
itLibrary
->
second
==
"FILE*"
||
itLibrary
->
second
==
"stdio.h"
)
{
auto
file
=
std
::
make_shared
<
transport
::
FilePointer
>
(
m_MPIComm
,
m_DebugMode
);
// m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
m_Transports
.
push_back
(
std
::
move
(
file
));
}
else
if
(
itLibrary
->
second
==
"fstream"
||
itLibrary
->
second
==
"std::fstream"
)
{
auto
file
=
std
::
make_shared
<
transport
::
FStream
>
(
m_MPIComm
,
m_DebugMode
);
// m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
m_Transports
.
push_back
(
std
::
move
(
file
));
}
else
if
(
itLibrary
->
second
==
"MPI-IO"
)
{
}
else
{
if
(
m_DebugMode
==
true
)
{
throw
std
::
invalid_argument
(
"ERROR: file transport library "
+
itLibrary
->
second
+
" not supported, in "
+
m_Name
+
m_EndMessage
);
}
}
}
else
{
if
(
m_DebugMode
==
true
)
{
throw
std
::
invalid_argument
(
"ERROR: transport "
+
itTransport
->
second
+
" (you mean File?) not supported, in "
+
m_Name
+
m_EndMessage
);
}
}
}
}
}
// end namespace adios
This diff is collapsed.
Click to expand it.
source/adios2/engine/bp/BPFileReader.h
+
15
−
37
View file @
81158552
...
...
@@ -2,18 +2,15 @@
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* BPReader.h
* BP
File
Reader.h
*
* Created on: Feb 27, 2017
* Author:
wfg
* Author:
William F Godoy godoywf@ornl.gov
*/
#ifndef ADIOS2_ENGINE_BP_BPFILEREADER_H_
#define ADIOS2_ENGINE_BP_BPFILEREADER_H_
#include
<iostream>
//this must go away
#include
"../../toolkit/capsule/heap/STLVector.h"
#include
"adios2/ADIOSConfig.h"
#include
"adios2/core/Engine.h"
...
...
@@ -25,24 +22,23 @@ class BPFileReader : public Engine
public:
/**
* Constructor for single BP capsule engine, writes in BP format into a
* single
* heap capsule
* @param name unique name given to the engine
* @param accessMode
* @param mpiComm
* @param method
* @param debugMode
* @param hostLanguage
*
*/
BPFileReader
(
ADIOS
&
adios
,
const
std
::
string
&
name
,
const
std
::
string
accessMode
,
MPI_Comm
mpiComm
,
const
Method
&
method
);
BPFileReader
(
IO
&
io
,
const
std
::
string
&
name
,
const
OpenMode
openMode
,
MPI_Comm
mpiComm
);
virtual
~
BPFileReader
()
=
default
;
Variable
<
void
>
*
InquireVariable
(
const
std
::
string
&
variableName
,
const
bool
readIn
=
true
);
void
Close
(
const
int
transportIndex
=
-
1
);
private:
void
Init
();
///< calls InitCapsules and InitTransports based on Method,
/// called from constructor
void
InitTransports
();
///< from Transports
VariableBase
*
InquireVariableUnknown
(
const
std
::
string
&
variableName
,
const
bool
readIn
=
true
);
Variable
<
char
>
*
InquireVariableChar
(
const
std
::
string
&
variableName
,
const
bool
readIn
=
true
);
...
...
@@ -109,24 +105,6 @@ public:
VariableCompound
*
InquireVariableCompound
(
const
std
::
string
&
variableName
,
const
bool
readIn
=
true
);
void
Close
(
const
int
transportIndex
=
-
1
);
private:
capsule
::
STLVector
m_Heap
;
///< heap capsule, contains data and metadata buffers
// format::BP1Writer m_BP1Writer; ///< format object will provide the
// required
// BP functionality to be applied on m_Buffer and m_Transports
void
Init
();
///< calls InitCapsules and InitTransports based on Method,
/// called from constructor
void
InitTransports
();
///< from Transports
std
::
string
GetMdtmParameter
(
const
std
::
string
parameter
,
const
std
::
map
<
std
::
string
,
std
::
string
>
&
mdtmParameters
);
template
<
class
T
>
Variable
<
T
>
*
InquireVariableCommon
(
const
std
::
string
&
name
,
const
bool
readIn
)
...
...
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