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
dd1fe426
Commit
dd1fe426
authored
7 years ago
by
guj
Browse files
Options
Downloads
Patches
Plain Diff
clang format
parent
5198f82b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!133
This fixes #117
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/heatTransfer/write/IO_ph5.cpp
+44
-36
44 additions, 36 deletions
examples/heatTransfer/write/IO_ph5.cpp
with
44 additions
and
36 deletions
examples/heatTransfer/write/IO_ph5.cpp
+
44
−
36
View file @
dd1fe426
...
@@ -35,12 +35,14 @@ public:
...
@@ -35,12 +35,14 @@ public:
const
hsize_t
*
count
);
const
hsize_t
*
count
);
void
applyMetadataCacheEviction
();
void
applyMetadataCacheEviction
();
void
WriteSimpleWithChunking
(
const
std
::
string
&
varName
,
int
dimSize
,
const
void
*
data
,
void
WriteSimpleWithChunking
(
const
std
::
string
&
varName
,
int
dimSize
,
hid_t
h5Type
,
const
hsize_t
*
shape
,
const
hsize_t
*
offset
,
const
void
*
data
,
hid_t
h5Type
,
const
hsize_t
*
count
);
const
hsize_t
*
shape
,
const
hsize_t
*
offset
,
const
hsize_t
*
count
);
int
m_CurrentTimeStep
;
int
m_CurrentTimeStep
;
unsigned
int
m_TotalTimeSteps
;
unsigned
int
m_TotalTimeSteps
;
bool
m_Chunking
;
bool
m_Chunking
;
private:
private:
hid_t
m_FilePropertyListId
;
hid_t
m_FilePropertyListId
;
hid_t
m_FileId
;
hid_t
m_FileId
;
...
@@ -48,7 +50,7 @@ private:
...
@@ -48,7 +50,7 @@ private:
};
};
HDF5NativeWriter
::
HDF5NativeWriter
(
const
std
::
string
&
fileName
)
HDF5NativeWriter
::
HDF5NativeWriter
(
const
std
::
string
&
fileName
)
:
m_CurrentTimeStep
(
0
),
m_TotalTimeSteps
(
0
),
m_Chunking
(
false
)
:
m_CurrentTimeStep
(
0
),
m_TotalTimeSteps
(
0
),
m_Chunking
(
false
)
{
{
m_FilePropertyListId
=
H5Pcreate
(
H5P_FILE_ACCESS
);
m_FilePropertyListId
=
H5Pcreate
(
H5P_FILE_ACCESS
);
...
@@ -75,8 +77,9 @@ HDF5NativeWriter::HDF5NativeWriter(const std::string &fileName)
...
@@ -75,8 +77,9 @@ HDF5NativeWriter::HDF5NativeWriter(const std::string &fileName)
}
}
std
::
string
prefix
=
"chunking"
;
std
::
string
prefix
=
"chunking"
;
if
(
fileName
.
substr
(
0
,
prefix
.
size
())
==
prefix
)
{
if
(
fileName
.
substr
(
0
,
prefix
.
size
())
==
prefix
)
m_Chunking
=
true
;
{
m_Chunking
=
true
;
}
}
}
}
...
@@ -85,17 +88,19 @@ HDF5NativeWriter::~HDF5NativeWriter() { Close(); }
...
@@ -85,17 +88,19 @@ HDF5NativeWriter::~HDF5NativeWriter() { Close(); }
void
HDF5NativeWriter
::
applyMetadataCacheEviction
()
void
HDF5NativeWriter
::
applyMetadataCacheEviction
()
{
{
#ifdef NEVER
#ifdef NEVER
/*
/*
see https://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/2011-February/004201.html
see
John said the code below worked for the paper but not anymore after updates
https://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/2011-February/004201.html
*/
John said the code below worked for the paper but not anymore after
H5AC_cache_config_t
mdc_config
;
updates
mdc_config
.
version
=
H5AC__CURR_CACHE_CONFIG_VERSION
;
*/
H5Pget_mdc_config
(
m_FilePropertyListId
,
&
mdc_config
);
H5AC_cache_config_t
mdc_config
;
mdc_config
.
evictions_enabled
=
0
;
// FALSE
mdc_config
.
version
=
H5AC__CURR_CACHE_CONFIG_VERSION
;
mdc_config
.
incr_mode
=
H5C_incr__off
;
H5Pget_mdc_config
(
m_FilePropertyListId
,
&
mdc_config
);
mdc_config
.
decr_mode
=
H5C_decr__off
;
mdc_config
.
evictions_enabled
=
0
;
// FALSE
H5Pset_mdc_config
(
m_FilePropertyListId
,
&
mdc_config
);
mdc_config
.
incr_mode
=
H5C_incr__off
;
mdc_config
.
decr_mode
=
H5C_decr__off
;
H5Pset_mdc_config
(
m_FilePropertyListId
,
&
mdc_config
);
#endif
#endif
}
}
...
@@ -169,8 +174,7 @@ void HDF5NativeWriter::WriteScalar(const std::string &varName, const void *data,
...
@@ -169,8 +174,7 @@ void HDF5NativeWriter::WriteScalar(const std::string &varName, const void *data,
hid_t
plistID
=
H5Pcreate
(
H5P_DATASET_XFER
);
hid_t
plistID
=
H5Pcreate
(
H5P_DATASET_XFER
);
H5Pset_dxpl_mpio
(
plistID
,
H5FD_MPIO_COLLECTIVE
);
H5Pset_dxpl_mpio
(
plistID
,
H5FD_MPIO_COLLECTIVE
);
herr_t
status
=
herr_t
status
=
H5Dwrite
(
dsetID
,
h5Type
,
H5S_ALL
,
H5S_ALL
,
plistID
,
data
);
H5Dwrite
(
dsetID
,
h5Type
,
H5S_ALL
,
H5S_ALL
,
plistID
,
data
);
H5Sclose
(
filespaceID
);
H5Sclose
(
filespaceID
);
H5Dclose
(
dsetID
);
H5Dclose
(
dsetID
);
...
@@ -214,20 +218,20 @@ void HDF5NativeWriter::WriteSimple(const std::string &varName, int dimSize,
...
@@ -214,20 +218,20 @@ void HDF5NativeWriter::WriteSimple(const std::string &varName, int dimSize,
H5Pclose
(
plistID
);
H5Pclose
(
plistID
);
}
}
void
HDF5NativeWriter
::
WriteSimpleWithChunking
(
const
std
::
string
&
varName
,
int
dimSize
,
void
HDF5NativeWriter
::
WriteSimpleWithChunking
(
const
void
*
data
,
hid_t
h5Type
,
const
std
::
string
&
varName
,
int
dimSize
,
const
void
*
data
,
hid_t
h5Type
,
const
hsize_t
*
shape
,
const
hsize_t
*
offset
,
const
hsize_t
*
shape
,
const
hsize_t
*
offset
,
const
hsize_t
*
count
)
const
hsize_t
*
count
)
{
{
CheckWriteGroup
();
CheckWriteGroup
();
hid_t
fileSpace
=
H5Screate_simple
(
dimSize
,
shape
,
NULL
);
hid_t
fileSpace
=
H5Screate_simple
(
dimSize
,
shape
,
NULL
);
hid_t
dsetPid
=
H5Pcreate
(
H5P_DATASET_CREATE
);
hid_t
dsetPid
=
H5Pcreate
(
H5P_DATASET_CREATE
);
H5Pset_chunk
(
dsetPid
,
dimSize
,
count
);
H5Pset_chunk
(
dsetPid
,
dimSize
,
count
);
size_t
bytes
=
H5Tget_size
(
h5Type
);
size_t
bytes
=
H5Tget_size
(
h5Type
);
for
(
int
i
=
0
;
i
<
dimSize
;
i
++
)
{
for
(
int
i
=
0
;
i
<
dimSize
;
i
++
)
bytes
*=
count
[
i
];
{
bytes
*=
count
[
i
];
}
}
hid_t
access_plistid
=
H5Pcreate
(
H5P_DATASET_ACCESS
);
hid_t
access_plistid
=
H5Pcreate
(
H5P_DATASET_ACCESS
);
H5Pset_chunk_cache
(
access_plistid
,
101
,
bytes
,
1
);
H5Pset_chunk_cache
(
access_plistid
,
101
,
bytes
,
1
);
...
@@ -263,7 +267,6 @@ void HDF5NativeWriter::WriteSimpleWithChunking(const std::string &varName, int d
...
@@ -263,7 +267,6 @@ void HDF5NativeWriter::WriteSimpleWithChunking(const std::string &varName, int d
H5Pclose
(
dsetPid
);
H5Pclose
(
dsetPid
);
H5Pclose
(
access_plistid
);
H5Pclose
(
access_plistid
);
}
}
//
//
...
@@ -307,12 +310,17 @@ void IO::write(int step, const HeatTransfer &ht, const Settings &s,
...
@@ -307,12 +310,17 @@ void IO::write(int step, const HeatTransfer &ht, const Settings &s,
std
::
vector
<
hsize_t
>
offset
=
{
s
.
offsx
,
s
.
offsy
};
std
::
vector
<
hsize_t
>
offset
=
{
s
.
offsx
,
s
.
offsy
};
std
::
vector
<
hsize_t
>
count
=
{
s
.
ndx
,
s
.
ndy
};
std
::
vector
<
hsize_t
>
count
=
{
s
.
ndx
,
s
.
ndy
};
if
(
h5writer
->
m_Chunking
)
{
if
(
h5writer
->
m_Chunking
)
h5writer
->
WriteSimpleWithChunking
(
"T"
,
2
,
ht
.
data_noghost
().
data
(),
H5T_NATIVE_DOUBLE
,
{
dims
.
data
(),
offset
.
data
(),
count
.
data
());
h5writer
->
WriteSimpleWithChunking
(
"T"
,
2
,
ht
.
data_noghost
().
data
(),
}
else
{
H5T_NATIVE_DOUBLE
,
dims
.
data
(),
h5writer
->
WriteSimple
(
"T"
,
2
,
ht
.
data_noghost
().
data
(),
H5T_NATIVE_DOUBLE
,
offset
.
data
(),
count
.
data
());
dims
.
data
(),
offset
.
data
(),
count
.
data
());
}
else
{
h5writer
->
WriteSimple
(
"T"
,
2
,
ht
.
data_noghost
().
data
(),
H5T_NATIVE_DOUBLE
,
dims
.
data
(),
offset
.
data
(),
count
.
data
());
}
}
h5writer
->
WriteScalar
(
"gndy"
,
&
(
s
.
gndy
),
H5T_NATIVE_UINT
);
h5writer
->
WriteScalar
(
"gndy"
,
&
(
s
.
gndy
),
H5T_NATIVE_UINT
);
...
...
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